Documentation ¶
Index ¶
- Variables
- type BackendServers
- type DefaultResponseFilter
- type DefaultShardingConfigs
- type EtcdGrpcClient
- type GroupRunner
- type GroupRunnerFactory
- type GroupRunnerFactoryImpl
- type GroupRunnerImpl
- type GrpcServer
- type ResponseFilter
- type Shard
- type ShardClient
- type ShardClientConfig
- type ShardClientImpl
- type ShardImpl
- type ShardingConfigs
- type ShardingProxy
- func (s *ShardingProxy) Compact(ctx context.Context, req *pb.CompactionRequest) (*pb.CompactionResponse, error)
- func (s *ShardingProxy) DeleteRange(ctx context.Context, req *pb.DeleteRangeRequest) (*pb.DeleteRangeResponse, error)
- func (s *ShardingProxy) Put(ctx context.Context, req *pb.PutRequest) (*pb.PutResponse, error)
- func (s *ShardingProxy) Range(ctx context.Context, req *pb.RangeRequest) (*pb.RangeResponse, error)
- func (s *ShardingProxy) Txn(ctx context.Context, req *pb.TxnRequest) (*pb.TxnResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = errors.New("not supported")
var ErrTxnDifferentShard = errors.Wrap(ErrNotSupported, "txn in different shard")
Functions ¶
This section is empty.
Types ¶
type BackendServers ¶
type DefaultResponseFilter ¶
type DefaultResponseFilter struct { }
func (DefaultResponseFilter) FilterDeleteRange ¶
func (DefaultResponseFilter) FilterDeleteRange(resps []*pb.DeleteRangeResponse) (*pb.DeleteRangeResponse, error)
func (DefaultResponseFilter) FilterRange ¶
func (DefaultResponseFilter) FilterRange(req *pb.RangeRequest, resps []*pb.RangeResponse) (*pb.RangeResponse, error)
type DefaultShardingConfigs ¶
type DefaultShardingConfigs struct {
// contains filtered or unexported fields
}
func NewDefaultShardingConfigs ¶
func NewDefaultShardingConfigs(shards []Shard) *DefaultShardingConfigs
func (*DefaultShardingConfigs) GetShardCli ¶
func (d *DefaultShardingConfigs) GetShardCli(shard int) ShardClient
func (*DefaultShardingConfigs) GetShardClis ¶
func (d *DefaultShardingConfigs) GetShardClis(key []byte, rangeEnd []byte) []ShardClient
type EtcdGrpcClient ¶
type GroupRunner ¶
type GroupRunnerFactory ¶
type GroupRunnerFactory interface {
GetGroupRunner() GroupRunner
}
func NewDefaultGroupRunnerFactory ¶
func NewDefaultGroupRunnerFactory() GroupRunnerFactory
type GroupRunnerFactoryImpl ¶
type GroupRunnerFactoryImpl struct { }
func (*GroupRunnerFactoryImpl) GetGroupRunner ¶
func (d *GroupRunnerFactoryImpl) GetGroupRunner() GroupRunner
type GroupRunnerImpl ¶
type GroupRunnerImpl struct {
// contains filtered or unexported fields
}
func (*GroupRunnerImpl) Add ¶
func (d *GroupRunnerImpl) Add(f func() error)
func (*GroupRunnerImpl) Do ¶
func (d *GroupRunnerImpl) Do() error
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
func NewGrpcServer ¶
func NewGrpcServer(servers BackendServers, opts ...grpc.ServerOption) (*GrpcServer, error)
type ResponseFilter ¶
type ResponseFilter interface { FilterRange(req *pb.RangeRequest, resps []*pb.RangeResponse) (*pb.RangeResponse, error) FilterDeleteRange([]*pb.DeleteRangeResponse) (*pb.DeleteRangeResponse, error) }
type Shard ¶
type Shard interface { Contains(key []byte, rangeEnd []byte) bool GetClient() ShardClient }
type ShardClient ¶
type ShardClientImpl ¶
type ShardClientImpl struct { EtcdGrpcClient // contains filtered or unexported fields }
func NewShardClientImpl ¶
func NewShardClientImpl(shardID int, address string) (*ShardClientImpl, error)
func (*ShardClientImpl) GetShardID ¶
func (s *ShardClientImpl) GetShardID() int
type ShardImpl ¶
type ShardImpl struct {
// contains filtered or unexported fields
}
ShardImpl is the implementation of Shard
func NewShardImpl ¶
func (*ShardImpl) GetClient ¶
func (s *ShardImpl) GetClient() ShardClient
GetClient returns the client of the shard.
type ShardingConfigs ¶
type ShardingConfigs interface { GetShardClis(key []byte, rangeEnd []byte) []ShardClient GetShardCli(shard int) ShardClient }
type ShardingProxy ¶
type ShardingProxy struct {
// contains filtered or unexported fields
}
func NewShardingProxy ¶
func NewShardingProxy(groupRunners GroupRunnerFactory, configs ShardingConfigs, respFilter ResponseFilter) *ShardingProxy
func (*ShardingProxy) Compact ¶
func (s *ShardingProxy) Compact(ctx context.Context, req *pb.CompactionRequest) (*pb.CompactionResponse, error)
Compact compacts the event history in the etcd key-value store. The key-value store should be periodically compacted or the event history will continue to grow indefinitely.
func (*ShardingProxy) DeleteRange ¶
func (s *ShardingProxy) DeleteRange(ctx context.Context, req *pb.DeleteRangeRequest) (*pb.DeleteRangeResponse, error)
DeleteRange deletes the given range from the key-value store. A delete request increments the revision of the key-value store and generates a delete event in the event history for every deleted key.
func (*ShardingProxy) Put ¶
func (s *ShardingProxy) Put(ctx context.Context, req *pb.PutRequest) (*pb.PutResponse, error)
Put puts the given key into the key-value store. A put request increments the revision of the key-value store and generates one event in the event history.
func (*ShardingProxy) Range ¶
func (s *ShardingProxy) Range(ctx context.Context, req *pb.RangeRequest) (*pb.RangeResponse, error)
Range gets the keys in the range from the key-value store.
func (*ShardingProxy) Txn ¶
func (s *ShardingProxy) Txn(ctx context.Context, req *pb.TxnRequest) (*pb.TxnResponse, error)
Txn processes multiple requests in a single transaction. A txn request increments the revision of the key-value store and generates events with the same revision for every completed request. It is not allowed to modify the same key several times within one txn.