Documentation ¶
Index ¶
Constants ¶
const (
// Kubernetes identifies kubernetes as the scheduler
Kubernetes = "kubernetes"
)
PX specific scheduler constants
Variables ¶
var ( // ErrKvdbNotInitialized is returned when kvdb is not initialized ErrKvdbNotInitialized = errors.New("KVDB is not initialized") )
Functions ¶
func GetSanitizedK8sName ¶
GetSanitizedK8sName will sanitize the name conforming to RFC 1123 standards so that it's a "qualified name" per k8s
Types ¶
type KeyDoesNotExist ¶
type KeyDoesNotExist struct {
Key string
}
KeyDoesNotExist is error type when the key does not exist
func (*KeyDoesNotExist) Error ¶
func (e *KeyDoesNotExist) Error() string
type KeyExists ¶
type KeyExists struct { // Key that exists Key string // Message is an optional message to the user Message string }
KeyExists is error type when the key already exist in store
type Lock ¶
type Lock struct { // Key is the name on which the lock is acquired. // This is used by the callers for logging purpose. Hence public Key string // Name of the Owner who acquired the lock Owner string // true if this lock was acquired using LockWithKey() interface LockedWithKey bool // contains filtered or unexported fields }
Lock identifies a lock taken over CloudDrive store
type Params ¶
type Params struct { // Kv is the bootstrap kvdb instance Kv kvdb.Kvdb // InternalKvdb indicates if PX is using internal kvdb or not InternalKvdb bool // SchedulerType indicates the platform pods are running on. e.g Kubernetes SchedulerType string }
Params is the parameters to use for the Store object
type Store ¶
type Store interface { // Lock locks the cloud drive store for a node to perform operations Lock(owner string) (*Lock, error) // Unlock unlocks the cloud drive store Unlock(storeLock *Lock) error // LockWithKey locks the cloud drive store with an arbitrary key LockWithKey(owner, key string) (*Lock, error) // IsKeyLocked checks if the specified key is currently locked IsKeyLocked(key string) (bool, string, error) // CreateKey creates the given key with the value. lockAs argument is used as an owner to lock the key. CreateKey(lockAs, key string, value []byte) error // PutKey updates the given key with the value. lockAs argument is used as an owner to lock the key. PutKey(lockAs, key string, value []byte) error // GetKey returns the value for the given key GetKey(key string) ([]byte, error) // DeleteKey deletes the given key. Sanitized version of the key is used internally for locking. DeleteKey(key string) error // EnumerateWithKeyPrefix enumerates all keys in the store that begin with the given key EnumerateWithKeyPrefix(key string) ([]string, error) }
Store provides a set of APIs to CloudDrive to store its metadata in a persistent store
func GetStoreWithParams ¶
func GetStoreWithParams( kv kvdb.Kvdb, schedulerType string, internalKvdb bool, name string, lockTryDuration time.Duration, lockHoldTimeout time.Duration, ) (Store, error)
GetStoreWithParams returns instance for Store kv: bootstrap kvdb schedulerType: node scheduler type e.g Kubernetes internalKvdb: If the cluster is configured to have internal kvdb name: Name for the store lockTryDuration: Total time to try acquiring the lock for lockHoldTimeout: Once a lock is acquired, if it's held beyond this time, there will be panic
func NewK8sStore ¶
NewK8sStore returns a Store implementation which uses k8s configmaps to store data.