dir

package
v2.6.0-beta.1+incompat... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package 'dir' implements the "directory backend". It uses a regular filesystem directories/files to store Teleport auth server state.

Limitations:

  • key names cannot start with '.' (dot)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetName

func GetName() string

GetName

func New

func New(params backend.Params) (backend.Backend, error)

New creates a new instance of Filesystem backend, it conforms to backend.NewFunc API

Types

type Backend

type Backend struct {
	// RootDir is the root (home) directory where the backend
	// stores all the data.
	RootDir string

	// InternalClock is a test-friendly source of current time
	InternalClock clockwork.Clock

	*log.Entry
}

fs.Backend implements backend.Backend interface using a regular POSIX-style filesystem

func (*Backend) AcquireLock

func (bk *Backend) AcquireLock(token string, ttl time.Duration) (err error)

AcquireLock grabs a lock that will be released automatically in TTL

func (*Backend) Clock

func (b *Backend) Clock() clockwork.Clock

func (*Backend) Close

func (bk *Backend) Close() error

Close releases the resources taken up by a 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

func (bk *Backend) CreateVal(bucket []string, key string, val []byte, ttl time.Duration) error

CreateVal creates value with a given TTL and key in the bucket if the value already exists, returns AlreadyExistsError

func (*Backend) DeleteBucket

func (bk *Backend) DeleteBucket(parent []string, bucket string) error

DeleteBucket deletes the bucket by a given path

func (*Backend) DeleteKey

func (bk *Backend) DeleteKey(bucket []string, key string) error

DeleteKey deletes a key in a bucket

func (*Backend) GetItems

func (bk *Backend) GetItems(bucket []string) ([]backend.Item, error)

GetItems is a function that returns keys in batch

func (*Backend) GetKeys

func (bk *Backend) GetKeys(bucket []string) ([]string, error)

GetKeys returns a list of keys for a given path

func (*Backend) GetVal

func (bk *Backend) GetVal(bucket []string, key string) ([]byte, error)

GetVal return a value for a given key in the bucket

func (*Backend) ReleaseLock

func (bk *Backend) ReleaseLock(token string) (err error)

ReleaseLock forces lock release before TTL

func (*Backend) UpsertVal

func (bk *Backend) UpsertVal(bucket []string, key string, val []byte, ttl time.Duration) error

UpsertVal updates or inserts value with a given TTL into a bucket ForeverTTL for no TTL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL