boltbk

package
v0.1.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package boltbk implements BoltDB backed backend for standalone instances and test mode, you should use Etcd in production

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON(paramsJSON string) (backend.Backend, error)

func FromObject

func FromObject(in interface{}) (backend.Backend, error)

FromString initialized the backend from backend-specific string

func GetBucket

func GetBucket(b *bolt.Tx, buckets []string) (*bolt.Bucket, error)

func UpsertBucket

func UpsertBucket(b *bolt.Tx, buckets []string) (*bolt.Bucket, error)

Types

type BoltBackend

type BoltBackend struct {
	sync.Mutex
	// contains filtered or unexported fields
}

BoltBackend is a boltdb-based backend used in tests and standalone mode

func New

func New(path string, opts ...Option) (*BoltBackend, error)

New returns a new isntance of bolt backend

func (*BoltBackend) AcquireLock

func (b *BoltBackend) AcquireLock(token string, ttl time.Duration) error

func (*BoltBackend) Close

func (b *BoltBackend) Close() error

Close closes the backend resources

func (*BoltBackend) CompareAndSwap

func (b *BoltBackend) CompareAndSwap(path []string, key string, val []byte, ttl time.Duration, prevVal []byte) ([]byte, error)

func (*BoltBackend) CreateVal added in v1.0.0

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

func (*BoltBackend) DeleteBucket

func (b *BoltBackend) DeleteBucket(path []string, bucket string) error

func (*BoltBackend) DeleteKey

func (b *BoltBackend) DeleteKey(path []string, key string) error

func (*BoltBackend) GetKeys

func (b *BoltBackend) GetKeys(path []string) ([]string, error)

func (*BoltBackend) GetVal

func (b *BoltBackend) GetVal(path []string, key string) ([]byte, error)

func (*BoltBackend) GetValAndTTL

func (b *BoltBackend) GetValAndTTL(path []string, key string) ([]byte, time.Duration, error)

func (*BoltBackend) ReleaseLock

func (b *BoltBackend) ReleaseLock(token string) error

func (*BoltBackend) TouchVal added in v1.0.0

func (b *BoltBackend) TouchVal(bucket []string, key string, ttl time.Duration) error

func (*BoltBackend) UpsertVal

func (b *BoltBackend) UpsertVal(path []string, key string, val []byte, ttl time.Duration) error

type Option added in v1.0.0

type Option func(b *BoltBackend) error

Option sets functional options for the backend

func Clock added in v1.0.0

func Clock(clock timetools.TimeProvider) Option

Clock sets clock for the backend, used in tests

Jump to

Keyboard shortcuts

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