{"modulePath":"github.com/github/git-lfs","version":"v2.5.2+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package kv\n\n## Functions\n\n```go\nfunc RegisterTypeForStorage(val interface{})\n```\nRegisterTypeForStorage registers a custom type (e.g. a struct) for use in the key value store. This is necessary if you intend to pass custom structs to Store.Set() rather than primitive types.\n\n## Types\n\n```go\ntype Store struct {\n\t// contains filtered or unexported fields\n}\n```\nStore provides an in-memory key/value store which is persisted to a file. The file handle itself is not kept locked for the duration; it is only locked during load and save, to make it concurrency friendly. When saving, the store uses optimistic locking to determine whether the db on disk has been modified by another process; in which case it loads the latest version and re-applies modifications made during this session. This means the Lost Update db concurrency issue is possible; so don't use this if you need more DB integrity than Read Committed isolation levels.\n\n```go\nfunc NewStore(filepath string) (*Store, error)\n```\nNewStore creates a new key/value store and initialises it with contents from the named file, if it exists\n\n```go\nfunc (k *Store) Get(key string) interface{}\n```\nGet retrieves a value from the store, or nil if it is not present\n\n```go\nfunc (k *Store) Remove(key string)\n```\nRemove removes the key and its value from the store in memory Changes are not persisted until you call Save()\n\n```go\nfunc (k *Store) RemoveAll()\n```\nRemoveAll removes all entries from the store These changes are not persisted until you call Save()\n\n```go\nfunc (k *Store) Save() error\n```\nSave persists the changes made to disk If any changes have been written by other code they will be merged\n\n```go\nfunc (k *Store) Set(key string, value interface{})\n```\nSet updates the key/value store in memory Changes are not persisted until you call Save()\n\n```go\nfunc (k *Store) Visit(cb func(string, interface{}) bool)\n```\nVisit walks through the entire store via a function; return false from your visitor function to halt the walk\n\n","path":"github.com/github/git-lfs/tools/kv","name":"kv","synopsis":"","isRedistributable":true}
