MCPcopy
hub / github.com/dosco/graphjin / Backend

Interface Backend

core/fstable/backend.go:54–85  ·  view source on GitHub ↗

Backend is the contract every filesystem implementation satisfies. Methods take a context so the engine's request deadlines and cancellation flow through to the SDK calls.

Source from the content-addressed store, hash-verified

52// Methods take a context so the engine's request deadlines and
53// cancellation flow through to the SDK calls.
54type Backend interface {
55 // Name reports the backend kind ("local", "s3", "gcs"). Used in logs
56 // and error messages — never as control-flow input by callers.
57 Name() string
58
59 // List enumerates entries under opts.Prefix, returning a page of
60 // results and an opaque token for the next page. nextToken is
61 // empty when the result set is fully drained.
62 List(ctx context.Context, opts ListOpts) (entries []Entry, nextToken string, err error)
63
64 // Stat returns metadata for a single key, or ErrNotFound if absent.
65 // No body is fetched.
66 Stat(ctx context.Context, key string) (Entry, error)
67
68 // Get returns the body and metadata for a key. Callers MUST close
69 // the returned reader. Returns ErrNotFound when the key is absent.
70 Get(ctx context.Context, key string) (io.ReadCloser, Entry, error)
71
72 // Put writes a value at key. The reader is consumed entirely; the
73 // returned Entry has Size populated from the actual bytes written.
74 Put(ctx context.Context, key string, body io.Reader, meta PutMeta) (Entry, error)
75
76 // Delete removes a key. Idempotent: deleting a missing key is not
77 // an error.
78 Delete(ctx context.Context, key string) error
79
80 // Presign returns a URL that grants the named operation on the key
81 // for ttl. Backends that don't support presigning (e.g. local) MAY
82 // return a non-presigned URL (file://) when op==PresignGet and
83 // ErrUnsupported when op==PresignPut.
84 Presign(ctx context.Context, key string, op PresignOp, ttl time.Duration) (string, error)
85}
86
87// Sentinel errors used uniformly by backends so the bridge can map
88// them to GraphQL-friendly responses without sniffing strings.

Callers 28

PutMethod · 0.65
LoadFunction · 0.65
TestLocal_ListPrefixFunction · 0.65
StatMethod · 0.65
StatMethod · 0.65
existsMethod · 0.65
ResolveMethod · 0.65
NewLocalFunction · 0.65
StatMethod · 0.65
PutMethod · 0.65

Implementers 6

readOnlyFilesystemBackendcore/fstable_cache.go
rotatingPresignBackendcore/fstable_bridge_test.go
Localcore/fstable/local.go
s3Backendserv/fstable_s3.go
gcsBackendserv/fstable_gcs.go

Calls

no outgoing calls

Tested by

no test coverage detected