mirror of https://github.com/docker/docs.git
store: Get rid of `structs.go` as it only contains errors/config
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
a897fa04d5
commit
924bde48e7
|
|
@ -1,6 +1,12 @@
|
||||||
package store
|
package store
|
||||||
|
|
||||||
import log "github.com/Sirupsen/logrus"
|
import (
|
||||||
|
"crypto/tls"
|
||||||
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
log "github.com/Sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
// Backend represents a KV Store Backend
|
// Backend represents a KV Store Backend
|
||||||
type Backend string
|
type Backend string
|
||||||
|
|
@ -14,9 +20,28 @@ const (
|
||||||
ZK = "zk"
|
ZK = "zk"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WatchCallback is used for watch methods on keys
|
var (
|
||||||
// and is triggered on key change
|
// ErrNotSupported is exported
|
||||||
type WatchCallback func(entries ...*KVPair)
|
ErrNotSupported = errors.New("Backend storage not supported yet, please choose another one")
|
||||||
|
// ErrNotImplemented is exported
|
||||||
|
ErrNotImplemented = errors.New("Call not implemented in current backend")
|
||||||
|
// ErrNotReachable is exported
|
||||||
|
ErrNotReachable = errors.New("Api not reachable")
|
||||||
|
// ErrCannotLock is exported
|
||||||
|
ErrCannotLock = errors.New("Error acquiring the lock")
|
||||||
|
// ErrWatchDoesNotExist is exported
|
||||||
|
ErrWatchDoesNotExist = errors.New("No watch found for specified key")
|
||||||
|
// ErrKeyModified is exported
|
||||||
|
ErrKeyModified = errors.New("Unable to complete atomic operation, key modified")
|
||||||
|
// ErrKeyNotFound is exported
|
||||||
|
ErrKeyNotFound = errors.New("Key not found in store")
|
||||||
|
)
|
||||||
|
|
||||||
|
// Config contains the options for a storage client
|
||||||
|
type Config struct {
|
||||||
|
TLS *tls.Config
|
||||||
|
Timeout time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
// Store represents the backend K/V storage
|
// Store represents the backend K/V storage
|
||||||
// Each store should support every call listed
|
// Each store should support every call listed
|
||||||
|
|
@ -72,6 +97,10 @@ type KVPair struct {
|
||||||
LastIndex uint64
|
LastIndex uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WatchCallback is used for watch methods on keys
|
||||||
|
// and is triggered on key change
|
||||||
|
type WatchCallback func(entries ...*KVPair)
|
||||||
|
|
||||||
// Locker provides locking mechanism on top of the store.
|
// Locker provides locking mechanism on top of the store.
|
||||||
// Similar to `sync.Lock` except it may return errors.
|
// Similar to `sync.Lock` except it may return errors.
|
||||||
type Locker interface {
|
type Locker interface {
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
package store
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"errors"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// ErrNotSupported is exported
|
|
||||||
ErrNotSupported = errors.New("Backend storage not supported yet, please choose another one")
|
|
||||||
// ErrNotImplemented is exported
|
|
||||||
ErrNotImplemented = errors.New("Call not implemented in current backend")
|
|
||||||
// ErrNotReachable is exported
|
|
||||||
ErrNotReachable = errors.New("Api not reachable")
|
|
||||||
// ErrCannotLock is exported
|
|
||||||
ErrCannotLock = errors.New("Error acquiring the lock")
|
|
||||||
// ErrWatchDoesNotExist is exported
|
|
||||||
ErrWatchDoesNotExist = errors.New("No watch found for specified key")
|
|
||||||
// ErrKeyModified is exported
|
|
||||||
ErrKeyModified = errors.New("Unable to complete atomic operation, key modified")
|
|
||||||
// ErrKeyNotFound is exported
|
|
||||||
ErrKeyNotFound = errors.New("Key not found in store")
|
|
||||||
)
|
|
||||||
|
|
||||||
// Config contains the options for a storage client
|
|
||||||
type Config struct {
|
|
||||||
TLS *tls.Config
|
|
||||||
Timeout time.Duration
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue