MCPcopy
hub / github.com/caddyserver/certmagic / Storage

Interface Storage

storage.go:62–105  ·  view source on GitHub ↗

Storage is a type that implements a key-value store with basic file system (folder path) semantics. Keys use the forward slash '/' to separate path components and have no leading or trailing slashes. A "prefix" of a key is defined on a component basis, e.g. "a" is a prefix of "a/b" but not "ab/c".

Source from the content-addressed store, hash-verified

60// For simplicity, this is not a streaming API and is not
61// suitable for very large files.
62type Storage interface {
63 // Locker enables the storage backend to synchronize
64 // operational units of work.
65 //
66 // The use of Locker is NOT employed around every
67 // Storage method call (Store, Load, etc), as these
68 // should already be thread-safe. Locker is used for
69 // high-level jobs or transactions that need
70 // synchronization across a cluster; it's a simple
71 // distributed lock. For example, CertMagic uses the
72 // Locker interface to coordinate the obtaining of
73 // certificates.
74 Locker
75
76 // Store puts value at key. It creates the key if it does
77 // not exist and overwrites any existing value at this key.
78 Store(ctx context.Context, key string, value []byte) error
79
80 // Load retrieves the value at key.
81 Load(ctx context.Context, key string) ([]byte, error)
82
83 // Delete deletes the named key. If the name is a
84 // directory (i.e. prefix of other keys), all keys
85 // prefixed by this key should be deleted. An error
86 // should be returned only if the key still exists
87 // when the method returns.
88 Delete(ctx context.Context, key string) error
89
90 // Exists returns true if the key exists either as
91 // a directory (prefix to other keys) or a file,
92 // and there was no error checking.
93 Exists(ctx context.Context, key string) bool
94
95 // List returns all keys in the given path.
96 //
97 // If recursive is true, non-terminal keys
98 // will be enumerated (i.e. "directories"
99 // should be walked); otherwise, only keys
100 // prefixed exactly by prefix will be listed.
101 List(ctx context.Context, path string, recursive bool) ([]string, error)
102
103 // Stat returns information about key.
104 Stat(ctx context.Context, key string) (KeyInfo, error)
105}
106
107// Locker facilitates synchronization across machines and networks.
108// It essentially provides a distributed named-mutex service so

Callers 37

PresentMethod · 0.65
storeTxFunction · 0.65
updateARIMethod · 0.65
CleanStorageFunction · 0.65
stapleOCSPFunction · 0.65
StoreMethod · 0.65
loadAccountMethod · 0.65
GetAccountMethod · 0.65
loadAccountByKeyMethod · 0.65

Implementers 3

memoryStorageaccount_test.go
recordingStorageaccount_test.go
FileStoragefilestorage.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…