zerodb

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client defines a data client, to connect to a 0-db server

func NewClient

func NewClient(addr, passwd, namespace string) (*Client, error)

NewClient creates a new data client, with given server address & password, and use the given namespace.

func (*Client) Close

func (c *Client) Close() error

Close implements datastor.Client.Close

func (*Client) CreateObject

func (c *Client) CreateObject(data []byte) (key []byte, err error)

CreateObject implements datastor.Client.CreateObject

func (*Client) DeleteObject

func (c *Client) DeleteObject(key []byte) error

DeleteObject implements datastor.Client.DeleteObject

func (*Client) ExistObject

func (c *Client) ExistObject(key []byte) (bool, error)

ExistObject implements datastor.Client.ExistObject

func (*Client) GetNamespace

func (c *Client) GetNamespace() (*datastor.Namespace, error)

GetNamespace implements datastor.Client.GetNamespace

func (*Client) GetObject

func (c *Client) GetObject(key []byte) (*datastor.Object, error)

GetObject implements datastor.Client.GetObject

func (*Client) GetObjectStatus

func (c *Client) GetObjectStatus(key []byte) (datastor.ObjectStatus, error)

GetObjectStatus implements datastor.Client.GetObjectStatus

func (*Client) ListObjectKeyIterator

func (c *Client) ListObjectKeyIterator(ctx context.Context) (<-chan datastor.ObjectKeyResult, error)

ListObjectKeyIterator implements datastor.Client.ListObjectKeyIterator TODO: depend on https://github.com/threefoldtech/0-db/issues/6

func (*Client) Utilization

func (c *Client) Utilization() int64

Utilization returns the amount of storage used by the namespace

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

Cluster implements datastor.Cluster for clients which interface with 0-db server using redis protocol

func NewCluster

func NewCluster(addresses []datastor.ShardConfig, passwd, namespace string, tlsConfig *tls.Config, spreadingType datastor.SpreadingType) (*Cluster, error)

NewCluster creates a new cluster, and pre-loading it with a client for each of the listed (and thus known) shards. Unlisted shards's clients are also stored, bu those are loaded on the fly, only when needed.

func (*Cluster) Close

func (c *Cluster) Close() error

Close implements datastor.Cluster.Close

func (*Cluster) GetRandomShard

func (c *Cluster) GetRandomShard() (datastor.Shard, error)

GetRandomShard implements datastor.Cluster.GetRandomShard

func (*Cluster) GetShard

func (c *Cluster) GetShard(address string) (datastor.Shard, error)

GetShard implements datastor.Cluster.GetShard

func (*Cluster) GetShardIterator

func (c *Cluster) GetShardIterator(exceptShards []string) datastor.ShardIterator

GetShardIterator implements datastor.Cluster.GetShardIterator

func (*Cluster) ListedShardCount

func (c *Cluster) ListedShardCount() int

ListedShardCount implements datastor.Cluster.ListedShardCount

type Shard

type Shard struct {
	*Client
	// contains filtered or unexported fields
}

Shard implements datastor.Shard for 0-db clients, to make those clients work within a cluster of other 0-db clients.

func (*Shard) Address

func (shard *Shard) Address() string

Address returns shard address

func (*Shard) Identifier

func (shard *Shard) Identifier() string

Identifier implements datastor.Shard.Identifier

func (*Shard) Namespace

func (shard *Shard) Namespace() string

Namespace returns shard namespace

func (*Shard) Password

func (shard *Shard) Password() string

Password returns shard password

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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