KVObject is Key/Value interface used by objects to be part of the Store.
| 25 | |
| 26 | // KVObject is Key/Value interface used by objects to be part of the Store. |
| 27 | type KVObject interface { |
| 28 | // Key method lets an object provide the Key to be used in KV Store |
| 29 | Key() []string |
| 30 | // KeyPrefix method lets an object return immediate parent key that can be used for tree walk |
| 31 | KeyPrefix() []string |
| 32 | // Value method lets an object marshal its content to be stored in the KV store |
| 33 | Value() []byte |
| 34 | // SetValue is used by the datastore to set the object's value when loaded from the data store. |
| 35 | SetValue([]byte) error |
| 36 | // Index method returns the latest DB Index as seen by the object |
| 37 | Index() uint64 |
| 38 | // SetIndex method allows the datastore to store the latest DB Index into the object |
| 39 | SetIndex(uint64) |
| 40 | // Exists returns true if the object exists in the datastore, false if it hasn't been stored yet. |
| 41 | // When SetIndex() is called, the object has been stored. |
| 42 | Exists() bool |
| 43 | // Skip provides a way for a KV Object to avoid persisting it in the KV Store |
| 44 | Skip() bool |
| 45 | // New returns a new object which is created based on the |
| 46 | // source object |
| 47 | New() KVObject |
| 48 | // CopyTo deep copies the contents of the implementing object |
| 49 | // to the passed destination object |
| 50 | CopyTo(KVObject) error |
| 51 | } |
| 52 | |
| 53 | const ( |
| 54 | // NetworkKeyPrefix is the prefix for network key in the kv store |
no outgoing calls
no test coverage detected
searching dependent graphs…