package dir
import "github.com/gravitational/teleport/lib/backend/dir"
dir package implements backend.Backend interface using the filesystem. The filesystem needs to be POSIX compliant and support BSD locks (flock).
Index ¶
- func GetName() string
- func New(params backend.Params) (backend.Backend, error)
- type Backend
- func (bk *Backend) AcquireLock(token string, ttl time.Duration) (err error)
- func (b *Backend) Clock() clockwork.Clock
- func (bk *Backend) Close() error
- func (bk *Backend) CompareAndSwapVal(bucket []string, key string, val []byte, prevVal []byte, ttl time.Duration) error
- func (bk *Backend) CreateVal(bucket []string, key string, val []byte, ttl time.Duration) error
- func (bk *Backend) DeleteBucket(parent []string, bucket string) error
- func (bk *Backend) DeleteKey(bucket []string, key string) error
- func (bk *Backend) GetItems(bucket []string, opts ...backend.OpOption) ([]backend.Item, error)
- func (bk *Backend) GetKeys(bucket []string, opts ...backend.OpOption) ([]string, error)
- func (bk *Backend) GetVal(bucket []string, key string) ([]byte, error)
- func (bk *Backend) ReleaseLock(token string) (err error)
- func (bk *Backend) UpsertItems(bucket []string, newItems []backend.Item) error
- func (bk *Backend) UpsertVal(bucket []string, key string, val []byte, ttl time.Duration) error
Functions ¶
func GetName ¶
func GetName() string
GetName returns the name of this backend.
func New ¶
New creates a new instance of a directory based backend that implements backend.Backend.
Types ¶
type Backend ¶
type Backend struct { // InternalClock is a test-friendly source of current time InternalClock clockwork.Clock // contains filtered or unexported fields }
Backend implements backend.Backend interface using a regular POSIX-style filesystem
func (*Backend) AcquireLock ¶
AcquireLock grabs a lock that will be released automatically in TTL.
func (*Backend) Clock ¶
Clock returns the clock used by this backend.
func (*Backend) Close ¶
Close releases the resources taken up the backend.
func (*Backend) CompareAndSwapVal ¶
func (bk *Backend) CompareAndSwapVal(bucket []string, key string, val []byte, prevVal []byte, ttl time.Duration) error
CompareAndSwapVal compares and swap values in atomic operation
func (*Backend) CreateVal ¶
CreateVal creates a key/value pair with the given TTL in the bucket. If the key already exists in the bucket, trace.AlreadyExists is returned.
func (*Backend) DeleteBucket ¶
DeleteBucket deletes the bucket by a given path.
func (*Backend) DeleteKey ¶
DeleteKey deletes a key in a bucket.
func (*Backend) GetItems ¶
GetItems returns all items (key/value pairs) in a given bucket.
func (*Backend) GetKeys ¶
GetKeys returns a list of keys for a given bucket.
func (*Backend) GetVal ¶
GetVal return a value for a given key in the bucket
func (*Backend) ReleaseLock ¶
ReleaseLock forces lock release before TTL.
func (*Backend) UpsertItems ¶
UpsertItems inserts (or updates if it already exists) all passed in backend.Items with the given TTL.
func (*Backend) UpsertVal ¶
UpsertVal inserts (or updates if it already exists) the value for a key with the given TTL.
Source Files ¶
- Version
- v3.2.17+incompatible (latest)
- Published
- Feb 4, 2021
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 1 month ago –
Tools for package owners.