MCPcopy
hub / github.com/esm-dev/esm.sh / Exists

Method Exists

server/build.go:99–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97}
98
99func (ctx *BuildContext) Exists() (meta *BuildMeta, ok bool, err error) {
100 key := ctx.Path()
101 meta, err = withLRUCache(key, func() (*BuildMeta, error) {
102 metadata, err := ctx.metaDB.Get(key)
103 if err != nil {
104 return nil, err
105 }
106 meta, err := decodeBuildMeta(metadata)
107 if err != nil {
108 // delete the invalid metadata
109 ctx.metaDB.Delete(key)
110 return nil, storage.ErrNotFound
111 }
112 return meta, nil
113 })
114 if err != nil {
115 if err == storage.ErrNotFound {
116 err = nil
117 }
118 return
119 }
120 ok = true
121 return
122}
123
124func (ctx *BuildContext) Context() context.Context {
125 if ctx.ctx != nil {

Callers 2

esmRouterFunction · 0.95
BuildMethod · 0.95

Calls 5

PathMethod · 0.95
withLRUCacheFunction · 0.85
decodeBuildMetaFunction · 0.85
GetMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected