persistence

package
v2.28.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeyspaceIdentifier

func GenerateKeyspaceIdentifier() string

GenerateKeyspaceIdentifier generates the unique ID for keyspaces

func ValidateKey

func ValidateKey(ksid string) bool

ValidateKey validates a keyspace id

Types

type Backend

type Backend interface {
	// CreateKeyspace should create a keyspace to store data
	CreateKeyspace(
		name, datacenter, contact string,
		replication int, ttl int,
	) gobol.Error
	// DeleteKeyspace should delete a keyspace from the database
	DeleteKeyspace(id string) gobol.Error
	// ListKeyspaces should return a list of all available keyspaces
	ListKeyspaces() ([]Keyspace, gobol.Error)
	// GetKeyspace should return the management data regarding the keyspace
	GetKeyspace(id string) (Keyspace, bool, gobol.Error)
	// UpdateKeyspace should update metadata and contact information about the
	// keyspace
	UpdateKeyspace(ksid, contact string) gobol.Error

	// ListDatacenters should list all available datacenters
	ListDatacenters() ([]string, gobol.Error)
}

Backend hides the underlying implementation of the persistence

type Keyspace

type Keyspace struct {
	// Name is a human-friendly name for the keyspace
	Name string `json:"name"`
	// Contact should be an email address for an owner of the keyspace
	Contact string `json:"contact"`
	// DC is the datacenter where the keyspace should reside
	DC string `json:"datacenter"`
	// TTL is the time-to-live for the keyspace data
	TTL int `json:"ttl"`
	// --- This will be removed ---
	Replication int `json:"replicationFactor"`
}

Keyspace represents a keyspace within the database

type Storage

type Storage struct {

	// Backend is the thing that actually does the specific work in the storage
	Backend
	// contains filtered or unexported fields
}

Storage is a storage for data

func NewStorage

func NewStorage(
	ksAdmin string,
	grantUser string,
	session *gocql.Session,
	metadata *metadata.Storage,
	timelineManager *tlmanager.Instance,
	devMode bool,
	defaultTTL int,
) (*Storage, error)

NewStorage creates a new storage persistence

func (*Storage) CreateKeyspace

func (storage *Storage) CreateKeyspace(
	name, datacenter, contact string,
	replication int, ttl int,
) gobol.Error

CreateKeyspace is a wrapper around the Backend in order to create metadata with the actual keyspace creation

func (*Storage) DatacenterExists

func (storage *Storage) DatacenterExists(dc string) (bool, gobol.Error)

DatacenterExists checks whether a given datacenter exists

func (*Storage) DeleteKeyspace

func (storage *Storage) DeleteKeyspace(id string) gobol.Error

DeleteKeyspace is a wrapper around keyspace deletion to ensure the metadata is deleted with the keyspace

Jump to

Keyboard shortcuts

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