func startServer(port int, keyFile, certFile, caCertFile string) *grpc.Server { // Arbitrary large numbers so the cleaner never needs to run. cache := server.NewCache("src/cache/test_data", 20*time.Hour, 100000, 100000000, 1000000000) s, lis := server.BuildGrpcServer(port, cache, keyFile, certFile, caCertFile, "", "") go s.Serve(lis) return s }
func init() { osName = runtime.GOOS + "_" + runtime.GOARCH label = core.NewBuildLabel("pkg/name", "label_name") target = core.NewBuildTarget(label) // Arbitrary large numbers so the cleaner never needs to run. cache := server.NewCache("src/cache/test_data", 20*time.Hour, 100000, 100000000, 1000000000) key, _ = ioutil.ReadFile("src/cache/test_data/testfile") testServer := httptest.NewServer(server.BuildRouter(cache)) config := core.DefaultConfiguration() config.Cache.HttpUrl = testServer.URL config.Cache.HttpWriteable = true httpcache = newHttpCache(config) }
func main() { cli.ParseFlagsOrDie("Please HTTP cache server", "5.5.0", &opts) cli.InitLogging(opts.Verbosity) if opts.LogFile != "" { cli.InitFileLogging(opts.LogFile, opts.Verbosity) } log.Notice("Initialising cache server...") cache := server.NewCache(opts.Dir, time.Duration(opts.CleanFlags.CleanFrequency), time.Duration(opts.CleanFlags.MaxArtifactAge), uint64(opts.CleanFlags.LowWaterMark), uint64(opts.CleanFlags.HighWaterMark)) log.Notice("Starting up http cache server on port %d...", opts.Port) router := server.BuildRouter(cache) http.Handle("/", router) http.ListenAndServe(fmt.Sprintf(":%d", opts.Port), router) }
func main() { cli.ParseFlagsOrDie("Please RPC cache server", "5.5.0", &opts) cli.InitLogging(opts.Verbosity) if opts.LogFile != "" { cli.InitFileLogging(opts.LogFile, opts.Verbosity) } if (opts.TLSFlags.KeyFile == "") != (opts.TLSFlags.CertFile == "") { log.Fatalf("Must pass both --key_file and --cert_file if you pass one") } else if opts.TLSFlags.KeyFile == "" && (opts.TLSFlags.WritableCerts != "" || opts.TLSFlags.ReadonlyCerts != "") { log.Fatalf("You can only use --writable_certs / --readonly_certs with https (--key_file and --cert_file)") } log.Notice("Scanning existing cache directory %s...", opts.Dir) cache := server.NewCache(opts.Dir, time.Duration(opts.CleanFlags.CleanFrequency), time.Duration(opts.CleanFlags.MaxArtifactAge), uint64(opts.CleanFlags.LowWaterMark), uint64(opts.CleanFlags.HighWaterMark)) log.Notice("Starting up RPC cache server on port %d...", opts.Port) server.ServeGrpcForever(opts.Port, cache, opts.TLSFlags.KeyFile, opts.TLSFlags.CertFile, opts.TLSFlags.CACertFile, opts.TLSFlags.ReadonlyCerts, opts.TLSFlags.WritableCerts) }