api

package
v0.0.0-...-a36e63d Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2016 License: Apache-2.0, Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGroupStore

func NewGroupStore(addr string, concurrency int, ftlsConfig *ftls.Config, opts ...grpc.DialOption) store.GroupStore

NewGroupStore creates a GroupStore connection via grpc to the given address.

func NewValueStore

func NewValueStore(addr string, concurrency int, ftlsConfig *ftls.Config, opts ...grpc.DialOption) store.ValueStore

NewValueStore creates a ValueStore connection via grpc to the given address.

Types

type GroupStoreConfig

type GroupStoreConfig struct {
	// Logger defines where log output will go. If not set, the logger will
	// default to zap.New(zap.NewJSONEncoder()).
	Logger zap.Logger
	// AddressIndex indicates which of the ring node addresses to use when
	// connecting to a node (see github.com/gholt/ring/Node.Address).
	AddressIndex int
	// ValueCap defines the maximum value size supported by the set of stores.
	// This defaults to 0xffffffff, or math.MaxUint32. In order to discover the
	// true value cap, all stores would have to be queried and then the lowest
	// cap used. However, that's probably not really necessary and configuring
	// a set value cap here is probably fine.
	ValueCap uint32
	// PoolSize sets how many store connections can be used per store endpoint.
	PoolSize int
	// ConcurrentRequestsPerStore defines the concurrent requests per
	// underlying connected store. Default: 1000
	ConcurrentRequestsPerStore int
	// FailedConnectRetryDelay defines how many seconds must pass before
	// retrying a failed connection. Default: 15 seconds
	FailedConnectRetryDelay int
	// StoreFTLSConfig is the ftls config you want use to build a tls.Config for
	// each grpc client used to communicate to the Store.
	StoreFTLSConfig *ftls.Config
	// GRPCOpts are any additional reusable options you'd like to pass to GRPC
	// when connecting to stores.
	GRPCOpts []grpc.DialOption
	// RingServer is the network address to use to connect to a ring server. An
	// empty string will use the default DNS method of determining the ring
	// server location.
	RingServer string
	// RingServerGRPCOpts are any additional options you'd like to pass to GRPC
	// when connecting to the ring server.
	RingServerGRPCOpts []grpc.DialOption
	// RingClientID is a unique identifier for this client, used when
	// registering with the RingServer. This allows the ring server to
	// proactively clean up stale connections should a reconnection be needed.
	RingClientID string
	// RingCachePath is the full location file name where you'd like persist
	// last received ring data, such as "/var/lib/myprog/ring/valuestore.ring".
	// An empty string will disable caching. The cacher will need permission to
	// create a new file with the path given plus a temporary suffix, and will
	// then move that temporary file into place using the exact path given.
	RingCachePath string
}

GroupStoreConfig defines the settings when calling NewGroupStore.

type PoolGroupStore

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

func NewPoolGroupStore

func NewPoolGroupStore(addr string, size int, concurrency int, ftlsConfig *ftls.Config, opts ...grpc.DialOption) *PoolGroupStore

func (*PoolGroupStore) AuditPass

func (ps *PoolGroupStore) AuditPass(ctx context.Context) error

func (*PoolGroupStore) Delete

func (ps *PoolGroupStore) Delete(ctx context.Context, keyA uint64, keyB uint64, childKeyA uint64, childKeyB uint64, timestampMicro int64) (int64, error)

func (*PoolGroupStore) DisableWrites

func (ps *PoolGroupStore) DisableWrites(ctx context.Context) error

func (*PoolGroupStore) EnableWrites

func (ps *PoolGroupStore) EnableWrites(ctx context.Context) error

func (*PoolGroupStore) Flush

func (ps *PoolGroupStore) Flush(ctx context.Context) error

func (*PoolGroupStore) Lookup

func (ps *PoolGroupStore) Lookup(ctx context.Context, keyA uint64, keyB uint64, childKeyA uint64, childKeyB uint64) (int64, uint32, error)

func (*PoolGroupStore) LookupGroup

func (ps *PoolGroupStore) LookupGroup(ctx context.Context, parentKeyA, parentKeyB uint64) ([]store.LookupGroupItem, error)

func (*PoolGroupStore) Read

func (ps *PoolGroupStore) Read(ctx context.Context, keyA uint64, keyB uint64, childKeyA uint64, childKeyB uint64, value []byte) (int64, []byte, error)

func (*PoolGroupStore) ReadGroup

func (ps *PoolGroupStore) ReadGroup(ctx context.Context, parentKeyA, parentKeyB uint64) ([]store.ReadGroupItem, error)

func (*PoolGroupStore) Shutdown

func (ps *PoolGroupStore) Shutdown(ctx context.Context) error

func (*PoolGroupStore) Startup

func (ps *PoolGroupStore) Startup(ctx context.Context) error

func (*PoolGroupStore) Stats

func (ps *PoolGroupStore) Stats(ctx context.Context, debug bool) (fmt.Stringer, error)

func (*PoolGroupStore) ValueCap

func (ps *PoolGroupStore) ValueCap(ctx context.Context) (uint32, error)

func (*PoolGroupStore) Write

func (ps *PoolGroupStore) Write(ctx context.Context, keyA uint64, keyB uint64, childKeyA uint64, childKeyB uint64, timestampMicro int64, value []byte) (int64, error)

type PoolValueStore

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

func NewPoolValueStore

func NewPoolValueStore(addr string, size int, concurrency int, ftlsConfig *ftls.Config, opts ...grpc.DialOption) *PoolValueStore

func (*PoolValueStore) AuditPass

func (ps *PoolValueStore) AuditPass(ctx context.Context) error

func (*PoolValueStore) Delete

func (ps *PoolValueStore) Delete(ctx context.Context, keyA uint64, keyB uint64, timestampMicro int64) (int64, error)

func (*PoolValueStore) DisableWrites

func (ps *PoolValueStore) DisableWrites(ctx context.Context) error

func (*PoolValueStore) EnableWrites

func (ps *PoolValueStore) EnableWrites(ctx context.Context) error

func (*PoolValueStore) Flush

func (ps *PoolValueStore) Flush(ctx context.Context) error

func (*PoolValueStore) Lookup

func (ps *PoolValueStore) Lookup(ctx context.Context, keyA uint64, keyB uint64) (int64, uint32, error)

func (*PoolValueStore) Read

func (ps *PoolValueStore) Read(ctx context.Context, keyA uint64, keyB uint64, value []byte) (int64, []byte, error)

func (*PoolValueStore) Shutdown

func (ps *PoolValueStore) Shutdown(ctx context.Context) error

func (*PoolValueStore) Startup

func (ps *PoolValueStore) Startup(ctx context.Context) error

func (*PoolValueStore) Stats

func (ps *PoolValueStore) Stats(ctx context.Context, debug bool) (fmt.Stringer, error)

func (*PoolValueStore) ValueCap

func (ps *PoolValueStore) ValueCap(ctx context.Context) (uint32, error)

func (*PoolValueStore) Write

func (ps *PoolValueStore) Write(ctx context.Context, keyA uint64, keyB uint64, timestampMicro int64, value []byte) (int64, error)

type ReplGroupStore

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

func NewReplGroupStore

func NewReplGroupStore(c *GroupStoreConfig) *ReplGroupStore

func (*ReplGroupStore) AuditPass

func (rs *ReplGroupStore) AuditPass(ctx context.Context) error

func (*ReplGroupStore) Delete

func (rs *ReplGroupStore) Delete(ctx context.Context, keyA uint64, keyB uint64, childKeyA, childKeyB uint64, timestampMicro int64) (int64, error)

func (*ReplGroupStore) DisableWrites

func (rs *ReplGroupStore) DisableWrites(ctx context.Context) error

func (*ReplGroupStore) EnableWrites

func (rs *ReplGroupStore) EnableWrites(ctx context.Context) error

func (*ReplGroupStore) Flush

func (rs *ReplGroupStore) Flush(ctx context.Context) error

func (*ReplGroupStore) Lookup

func (rs *ReplGroupStore) Lookup(ctx context.Context, keyA, keyB uint64, childKeyA, childKeyB uint64) (int64, uint32, error)

func (*ReplGroupStore) LookupGroup

func (rs *ReplGroupStore) LookupGroup(ctx context.Context, parentKeyA, parentKeyB uint64) ([]store.LookupGroupItem, error)

func (*ReplGroupStore) Read

func (rs *ReplGroupStore) Read(ctx context.Context, keyA uint64, keyB uint64, childKeyA, childKeyB uint64, value []byte) (int64, []byte, error)

func (*ReplGroupStore) ReadGroup

func (rs *ReplGroupStore) ReadGroup(ctx context.Context, parentKeyA, parentKeyB uint64) ([]store.ReadGroupItem, error)

func (*ReplGroupStore) Ring

func (rs *ReplGroupStore) Ring(ctx context.Context) ring.Ring

func (*ReplGroupStore) SetRing

func (rs *ReplGroupStore) SetRing(r ring.Ring)

func (*ReplGroupStore) Shutdown

func (rs *ReplGroupStore) Shutdown(ctx context.Context) error

Shutdown will close all connections to backend stores and shutdown any running ring service connector. Note that the ReplGroupStore can still be used after Shutdown, it will just start reconnecting to backends again. To relaunch the ring service connector, you will need to call Startup.

func (*ReplGroupStore) Startup

func (rs *ReplGroupStore) Startup(ctx context.Context) error

Startup is not required to use the ReplGroupStore; it will automatically connect to backend stores as needed. However, if you'd like to use the ring service to receive ring updates and have the ReplGroupStore automatically update itself accordingly, Startup will launch a connector to that service. Otherwise, you will need to call SetRing yourself to inform the ReplGroupStore of which backends to connect to.

func (*ReplGroupStore) Stats

func (rs *ReplGroupStore) Stats(ctx context.Context, debug bool) (fmt.Stringer, error)

func (*ReplGroupStore) ValueCap

func (rs *ReplGroupStore) ValueCap(ctx context.Context) (uint32, error)

func (*ReplGroupStore) Write

func (rs *ReplGroupStore) Write(ctx context.Context, keyA uint64, keyB uint64, childKeyA, childKeyB uint64, timestampMicro int64, value []byte) (int64, error)

type ReplGroupStoreError

type ReplGroupStoreError interface {
	error
	Store() store.GroupStore
	Err() error
}

type ReplGroupStoreErrorNotFound

type ReplGroupStoreErrorNotFound ReplGroupStoreErrorSlice

func (ReplGroupStoreErrorNotFound) ErrNotFound

func (e ReplGroupStoreErrorNotFound) ErrNotFound() string

func (ReplGroupStoreErrorNotFound) Error

type ReplGroupStoreErrorSlice

type ReplGroupStoreErrorSlice []ReplGroupStoreError

func (ReplGroupStoreErrorSlice) Error

func (es ReplGroupStoreErrorSlice) Error() string

type ReplValueStore

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

func NewReplValueStore

func NewReplValueStore(c *ValueStoreConfig) *ReplValueStore

func (*ReplValueStore) AuditPass

func (rs *ReplValueStore) AuditPass(ctx context.Context) error

func (*ReplValueStore) Delete

func (rs *ReplValueStore) Delete(ctx context.Context, keyA uint64, keyB uint64, timestampMicro int64) (int64, error)

func (*ReplValueStore) DisableWrites

func (rs *ReplValueStore) DisableWrites(ctx context.Context) error

func (*ReplValueStore) EnableWrites

func (rs *ReplValueStore) EnableWrites(ctx context.Context) error

func (*ReplValueStore) Flush

func (rs *ReplValueStore) Flush(ctx context.Context) error

func (*ReplValueStore) Lookup

func (rs *ReplValueStore) Lookup(ctx context.Context, keyA, keyB uint64) (int64, uint32, error)

func (*ReplValueStore) Read

func (rs *ReplValueStore) Read(ctx context.Context, keyA uint64, keyB uint64, value []byte) (int64, []byte, error)

func (*ReplValueStore) Ring

func (rs *ReplValueStore) Ring(ctx context.Context) ring.Ring

func (*ReplValueStore) SetRing

func (rs *ReplValueStore) SetRing(r ring.Ring)

func (*ReplValueStore) Shutdown

func (rs *ReplValueStore) Shutdown(ctx context.Context) error

Shutdown will close all connections to backend stores and shutdown any running ring service connector. Note that the ReplValueStore can still be used after Shutdown, it will just start reconnecting to backends again. To relaunch the ring service connector, you will need to call Startup.

func (*ReplValueStore) Startup

func (rs *ReplValueStore) Startup(ctx context.Context) error

Startup is not required to use the ReplValueStore; it will automatically connect to backend stores as needed. However, if you'd like to use the ring service to receive ring updates and have the ReplValueStore automatically update itself accordingly, Startup will launch a connector to that service. Otherwise, you will need to call SetRing yourself to inform the ReplValueStore of which backends to connect to.

func (*ReplValueStore) Stats

func (rs *ReplValueStore) Stats(ctx context.Context, debug bool) (fmt.Stringer, error)

func (*ReplValueStore) ValueCap

func (rs *ReplValueStore) ValueCap(ctx context.Context) (uint32, error)

func (*ReplValueStore) Write

func (rs *ReplValueStore) Write(ctx context.Context, keyA uint64, keyB uint64, timestampMicro int64, value []byte) (int64, error)

type ReplValueStoreError

type ReplValueStoreError interface {
	error
	Store() store.ValueStore
	Err() error
}

type ReplValueStoreErrorNotFound

type ReplValueStoreErrorNotFound ReplValueStoreErrorSlice

func (ReplValueStoreErrorNotFound) ErrNotFound

func (e ReplValueStoreErrorNotFound) ErrNotFound() string

func (ReplValueStoreErrorNotFound) Error

type ReplValueStoreErrorSlice

type ReplValueStoreErrorSlice []ReplValueStoreError

func (ReplValueStoreErrorSlice) Error

func (es ReplValueStoreErrorSlice) Error() string

type ValueStoreConfig

type ValueStoreConfig struct {
	// Logger defines where log output will go. If not set, the logger will
	// default to zap.New(zap.NewJSONEncoder()).
	Logger zap.Logger
	// AddressIndex indicates which of the ring node addresses to use when
	// connecting to a node (see github.com/gholt/ring/Node.Address).
	AddressIndex int
	// ValueCap defines the maximum value size supported by the set of stores.
	// This defaults to 0xffffffff, or math.MaxUint32. In order to discover the
	// true value cap, all stores would have to be queried and then the lowest
	// cap used. However, that's probably not really necessary and configuring
	// a set value cap here is probably fine.
	ValueCap uint32
	// PoolSize sets how many store connections can be used per store endpoint.
	PoolSize int
	// ConcurrentRequestsPerStore defines the concurrent requests per
	// underlying connected store. Default: 1000
	ConcurrentRequestsPerStore int
	// FailedConnectRetryDelay defines how many seconds must pass before
	// retrying a failed connection. Default: 15 seconds
	FailedConnectRetryDelay int
	// StoreFTLSConfig is the ftls config you want use to build a tls.Config for
	// each grpc client used to communicate to the Store.
	StoreFTLSConfig *ftls.Config
	// GRPCOpts are any additional reusable options you'd like to pass to GRPC
	// when connecting to stores.
	GRPCOpts []grpc.DialOption
	// RingServer is the network address to use to connect to a ring server. An
	// empty string will use the default DNS method of determining the ring
	// server location.
	RingServer string
	// RingServerGRPCOpts are any additional options you'd like to pass to GRPC
	// when connecting to the ring server.
	RingServerGRPCOpts []grpc.DialOption
	// RingClientID is a unique identifier for this client, used when
	// registering with the RingServer. This allows the ring server to
	// proactively clean up stale connections should a reconnection be needed.
	RingClientID string
	// RingCachePath is the full location file name where you'd like persist
	// last received ring data, such as "/var/lib/myprog/ring/valuestore.ring".
	// An empty string will disable caching. The cacher will need permission to
	// create a new file with the path given plus a temporary suffix, and will
	// then move that temporary file into place using the exact path given.
	RingCachePath string
}

ValueStoreConfig defines the settings when calling NewValueStore.

Directories

Path Synopsis
Package groupproto is a generated protocol buffer package.
Package groupproto is a generated protocol buffer package.
Package valueproto is a generated protocol buffer package.
Package valueproto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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