oort

package
v0.0.0-...-4437b4c Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package oort provides a client for accessing an Oort server cluster.

Note that errors in this package may be of the types Repl*StoreError, Repl*StoreErrorNotFound, and Repl*StoreErrorSlice. These error types pair the store and specific error from that store into an overall error type since this package's Store implementations will behave like a single store, but in reality are communicating with multiple stores in a cluster. Generally speaking, the overall error is what is important, but the encapsulated errors can be very beneficial with troubleshooting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 creating new stores, such as NewReplGroupStore.

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. Note that the ReplGroupStore can still be used after Shutdown, it will just start reconnecting to backends again.

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.

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. Note that the ReplValueStore can still be used after Shutdown, it will just start reconnecting to backends again.

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.

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 creating new stores, such as NewReplValueStore.

Directories

Path Synopsis
Package groupproto is a generated protocol buffer package.
Package groupproto is a generated protocol buffer package.
Package proto contains code commonly used for both clients and servers of the Oort services.
Package proto contains code commonly used for both clients and servers of the Oort services.
Package server provides a server implementation of a single node of an Oort cluster.
Package server provides a server implementation of a single node of an Oort cluster.
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