Documentation ¶
Overview ¶
Copyright 2015 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
backend package allows for pluggable back-ends for secrets storage. To implement a new storage back-end you have to supply an object which:
- implements backend.Backend interface
- implements backend.NewFunc function
Index ¶
Constants ¶
Forever means that object TTL will not expire unless deleted
Variables ¶
This section is empty.
Functions ¶
func AnyTTL ¶
AnyTTL returns TTL if any of the suplied times pass expiry time otherwise returns forever
func TTL ¶
TTL converts time to TTL from current time supplied by provider, if t is zero, returns forever
func ValidateLockTTL ¶
ValidateLockTTL helper allows all backends to validate lock TTL parameter
Types ¶
type Backend ¶
type Backend interface { // GetKeys returns a list of keys for a given path GetKeys(bucket []string) ([]string, error) // CreateVal creates value with a given TTL and key in the bucket // if the value already exists, it must return trace.AlreadyExistsError CreateVal(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 UpsertVal(bucket []string, key string, val []byte, ttl time.Duration) error // GetVal return a value for a given key in the bucket GetVal(path []string, key string) ([]byte, error) // CompareAndSwapVal compares and swaps values in atomic operation, // succeeds if prevVal matches the value stored in the database, // requires prevVal as a non-empty value. Returns trace.CompareFailed // in case if value did not match. CompareAndSwapVal(bucket []string, key string, val []byte, prevVal []byte, ttl time.Duration) error // DeleteKey deletes a key in a bucket DeleteKey(bucket []string, key string) error // DeleteBucket deletes the bucket by a given path DeleteBucket(path []string, bkt string) error // AcquireLock grabs a lock that will be released automatically in TTL AcquireLock(token string, ttl time.Duration) error // ReleaseLock forces lock release before TTL ReleaseLock(token string) error // Close releases the resources taken up by this backend Close() error // Clock returns clock used by this backend Clock() clockwork.Clock }
Backend implements abstraction over local or remote storage backend
Storage is modeled after BoltDB:
- bucket is a slice []string{"a", "b"}
- buckets contain key value pairs
type Config ¶ added in v1.2.6
type Config struct { // Type can be "bolt" or "etcd" or "dynamodb" Type string `yaml:"type,omitempty"` // Params is a generic key/value property bag which allows arbitrary // falues to be passed to backend Params Params `yaml:",inline"` }
Config is used for 'storage' config section. It's a combination of values for various backends: 'boltdb', 'etcd', 'filesystem' and 'dynamodb'
type ItemsGetter ¶
type ItemsGetter interface { // GetItems returns a list of items - key value pairs GetItems(bucket []string) ([]Item, error) }
ItemsGetter is an interface that allows gettings all items in the bucket at once
type JSONCodec ¶
type JSONCodec struct {
Backend
}
func (*JSONCodec) CreateJSONVal ¶ added in v1.0.0
func (*JSONCodec) GetJSONVal ¶
type NameFunc ¶
type NameFunc func() string
NameFunc type defines a function type which every backend must implement to return its name
type NewFunc ¶
NewFunc type defines a function type which every backend must implement to instantiate itself
Directories ¶
Path | Synopsis |
---|---|
Package boltbk implements BoltDB backed backend for standalone instances This is a legacy backend which only exists for backward compatibility purposes Production Teleport clusters should be using either etcd or DynamoDB backends.
|
Package boltbk implements BoltDB backed backend for standalone instances This is a legacy backend which only exists for backward compatibility purposes Production Teleport clusters should be using either etcd or DynamoDB backends. |
Package 'dir' implements the "directory backend".
|
Package 'dir' implements the "directory backend". |
Package dynamodbDynamoDBBackend implements DynamoDB storage backend for Teleport auth service, similar to etcd backend.
|
Package dynamodbDynamoDBBackend implements DynamoDB storage backend for Teleport auth service, similar to etcd backend. |
Package etcdbk implements Etcd powered backend
|
Package etcdbk implements Etcd powered backend |
Package test contains a backend acceptance test suite that is backend implementation independent each backend will use the suite to test itself
|
Package test contains a backend acceptance test suite that is backend implementation independent each backend will use the suite to test itself |