MCPcopy Index your code
hub / github.com/perkeep/perkeep / newFromConfig

Function newFromConfig

pkg/blobserver/proxycache/proxycache.go:88–106  ·  view source on GitHub ↗
(ld blobserver.Loader, config jsonconfig.Obj)

Source from the content-addressed store, hash-verified

86}
87
88func newFromConfig(ld blobserver.Loader, config jsonconfig.Obj) (blobserver.Storage, error) {
89 var (
90 origin = config.RequiredString("origin")
91 cache = config.RequiredString("cache")
92 maxCacheBytes = config.OptionalInt64("maxCacheBytes", 512<<20)
93 )
94 if err := config.Validate(); err != nil {
95 return nil, err
96 }
97 cacheSto, err := ld.GetStorage(cache)
98 if err != nil {
99 return nil, err
100 }
101 originSto, err := ld.GetStorage(origin)
102 if err != nil {
103 return nil, err
104 }
105 return New(maxCacheBytes, cacheSto, originSto), nil
106}
107
108// must hold sto.mu.
109// Reports whether an item was removed.

Callers 1

TestConfigFunction · 0.70

Calls 2

NewFunction · 0.70
GetStorageMethod · 0.65

Tested by 1

TestConfigFunction · 0.56