MCPcopy
hub / github.com/perkeep/perkeep / KeyValue

Interface KeyValue

pkg/sorted/kv.go:42–74  ·  view source on GitHub ↗

KeyValue is a sorted, enumerable key-value interface supporting batch mutations.

Source from the content-addressed store, hash-verified

40// KeyValue is a sorted, enumerable key-value interface supporting
41// batch mutations.
42type KeyValue interface {
43 // Get gets the value for the given key. It returns ErrNotFound if the DB
44 // does not contain the key.
45 Get(key string) (string, error)
46
47 Set(key, value string) error
48
49 // Delete deletes keys. Deleting a non-existent key does not return an error.
50 Delete(key string) error
51
52 BeginBatch() BatchMutation
53 CommitBatch(b BatchMutation) error
54
55 // Find returns an iterator positioned before the first key/value pair
56 // whose key is 'greater than or equal to' the given key. There may be no
57 // such pair, in which case the iterator will return false on Next.
58 //
59 // The optional end value specifies the exclusive upper
60 // bound. If the empty string, the iterator returns keys
61 // where "key >= start".
62 // If non-empty, the iterator returns keys where
63 // "key >= start && key < endHint".
64 //
65 // Any error encountered will be implicitly returned via the iterator. An
66 // error-iterator will yield no key/value pairs and closing that iterator
67 // will return that error.
68 Find(start, end string) Iterator
69
70 // Close is a polite way for the server to shut down the storage.
71 // Implementations should never lose data after a Set, Delete,
72 // or CommmitBatch, though.
73 Close() error
74}
75
76// TransactionalReader is an optional interface that may be implemented by storage
77// implementations. It may be implemented when a storage backend supports multiple

Callers 74

UploadMethod · 0.65
FileHasContentsMethod · 0.65
discoveryRespMethod · 0.65
RedirectStateMethod · 0.65
doMethod · 0.65
importTweetMethod · 0.65
doStatMethod · 0.65
UploadMethod · 0.65
discoveryRespMethod · 0.65
postMethod · 0.65

Implementers 6

memKeyspkg/sorted/mem.go
kvispkg/sorted/kvfile/kvfile.go
keyValuepkg/sorted/mongo/mongokv.go
KeyValuepkg/sorted/buffer/buffer.go
KeyValuepkg/sorted/sqlkv/sqlkv.go
kvispkg/sorted/leveldb/leveldb.go

Calls

no outgoing calls

Tested by

no test coverage detected