Documentation ¶
Index ¶
- Constants
- Variables
- func NewRaftNode(id int, peers []string, join bool, getSnapshot func() ([]byte, error), ...) (<-chan *string, <-chan error, <-chan *snap.Snapshotter)
- type AddNodeRequest
- type Bitmap
- type BitmapDstAndPairRequest
- type BitmapPairRequest
- type BitmapStoreRequest
- type BitmapValueRequest
- type BitmapValuesRequest
- type Bitmaps
- func (bs *Bitmaps) Add(name string, v uint32, callback bool)
- func (bs *Bitmaps) AddMany(name string, v []uint32, callback bool)
- func (bs *Bitmaps) Card(name string) uint64
- func (bs *Bitmaps) ClearBitmap(name string, callback bool)
- func (bs *Bitmaps) Diff(name1, name2 string) []uint32
- func (bs *Bitmaps) DiffStore(destination, name1, name2 string) uint64
- func (bs *Bitmaps) Exists(name string, v uint32) bool
- func (bs *Bitmaps) Inter(names ...string) []uint32
- func (bs *Bitmaps) InterStore(destination string, names ...string) uint64
- func (bs *Bitmaps) Read(r io.Reader) error
- func (bs *Bitmaps) Remove(name string, v uint32, callback bool)
- func (bs *Bitmaps) RemoveBitmap(name string, callback bool)
- func (bs *Bitmaps) Save(w io.Writer) error
- func (bs *Bitmaps) Stats(name string) Stats
- func (bs *Bitmaps) Union(names ...string) []uint32
- func (bs *Bitmaps) UnionStore(destination string, names ...string) uint64
- func (bs *Bitmaps) Xor(name1, name2 string) []uint32
- func (bs *Bitmaps) XorStore(destination, name1, name2 string) uint64
- type ConfChange
- type ConfigRpcxOption
- type HTTPService
- type OP
- type RaftServer
- type RedisService
- type RpcxBitmapService
- func (s *RpcxBitmapService) Add(ctx context.Context, req *BitmapValueRequest, reply *bool) error
- func (s *RpcxBitmapService) AddMany(ctx context.Context, req *BitmapValuesRequest, reply *bool) error
- func (s *RpcxBitmapService) AddNode(ctx context.Context, req *AddNodeRequest, reply *bool) error
- func (s *RpcxBitmapService) Card(ctx context.Context, name string, reply *uint64) error
- func (s *RpcxBitmapService) ClearBitmap(ctx context.Context, name string, reply *bool) error
- func (s *RpcxBitmapService) Diff(ctx context.Context, names *BitmapPairRequest, reply *[]uint32) error
- func (s *RpcxBitmapService) DiffStore(ctx context.Context, names *BitmapDstAndPairRequest, reply *bool) error
- func (s *RpcxBitmapService) Exists(ctx context.Context, req *BitmapValueRequest, reply *bool) error
- func (s *RpcxBitmapService) Inter(ctx context.Context, names []string, reply *[]uint32) error
- func (s *RpcxBitmapService) InterStore(ctx context.Context, req *BitmapStoreRequest, reply *bool) error
- func (s *RpcxBitmapService) Remove(ctx context.Context, req *BitmapValueRequest, reply *bool) error
- func (s *RpcxBitmapService) RemoveBitmap(ctx context.Context, name string, reply *bool) error
- func (s *RpcxBitmapService) RemoveNode(ctx context.Context, req uint64, reply *bool) error
- func (s *RpcxBitmapService) Save(ctx context.Context, dummy string, reply *bool) error
- func (s *RpcxBitmapService) Stats(ctx context.Context, name string, reply *Stats) error
- func (s *RpcxBitmapService) Union(ctx context.Context, names []string, reply *[]uint32) error
- func (s *RpcxBitmapService) UnionStore(ctx context.Context, req *BitmapStoreRequest, reply *bool) error
- func (s *RpcxBitmapService) Xor(ctx context.Context, names *BitmapPairRequest, reply *[]uint32) error
- func (s *RpcxBitmapService) XorStore(ctx context.Context, names *BitmapDstAndPairRequest, reply *bool) error
- type Server
- type Stats
Constants ¶
const ( BmOpAdd OP = 1 BmOpAddMany = 2 BmOpRemove = 3 BmOpDrop = 4 BmOpClear = 5 )
Variables ¶
var (
ErrPersistFileNotFound = errors.New("persist file not found")
)
Errors for bitmaps
Functions ¶
func NewRaftNode ¶
func NewRaftNode(id int, peers []string, join bool, getSnapshot func() ([]byte, error), proposeC <-chan string, confChangeC <-chan raftpb.ConfChange) (<-chan *string, <-chan error, <-chan *snap.Snapshotter)
newRaftNode initiates a raft instance and returns a committed log entry channel and error channel. Proposals for log updates are sent over the provided the proposal channel. All log entries are replayed over the commit channel, followed by a nil message (to indicate the channel is current), then new log entries. To shutdown, close proposeC and read errorC.
Types ¶
type AddNodeRequest ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
Bitmap is the goroutine-safe bitmap.
type BitmapDstAndPairRequest ¶
BitmapDstAndPairRequest contains destination and the name of two bitmaps.
type BitmapPairRequest ¶
BitmapPairRequest contains the name of two bitmaps.
type BitmapStoreRequest ¶
BitmapStoreRequest contains the name of destination and names of bitmaps.
type BitmapValueRequest ¶
BitmapValueRequest contains the name of bitmap and value.
type BitmapValuesRequest ¶
BitmapValuesRequest contains the name of bitmap and values.
type Bitmaps ¶
type Bitmaps struct {
// contains filtered or unexported fields
}
Bitmaps contains all bitmaps of namespace.
func (*Bitmaps) ClearBitmap ¶
ClearBitmap clear a bitmap.
func (*Bitmaps) DiffStore ¶
DiffStore computes the difference between two bitmaps and save the result to destination.
func (*Bitmaps) InterStore ¶
InterStore computes the intersection (AND) of all provided bitmaps and save to destination.
func (*Bitmaps) RemoveBitmap ¶
RemoveBitmap removes a bitmap.
func (*Bitmaps) UnionStore ¶
UnionStore computes the union (OR) of all provided bitmaps and store to destination.
type ConfChange ¶
type ConfigRpcxOption ¶
ConfigRpcxOption defines the rpcx config function.
type HTTPService ¶
type HTTPService struct {
// contains filtered or unexported fields
}
HTTPService is a http service.
type RaftServer ¶
type RaftServer struct {
// contains filtered or unexported fields
}
func NewRaftServer ¶
func NewRaftServer(bmServer *Server, snapshotter *snap.Snapshotter, confChangeC chan raftpb.ConfChange, proposeC chan<- string, commitC <-chan *string, errorC <-chan error) *RaftServer
func (*RaftServer) GetSnapshot ¶
func (s *RaftServer) GetSnapshot() ([]byte, error)
func (*RaftServer) Propose ¶
func (s *RaftServer) Propose(op OP, value string)
func (*RaftServer) RemoveNode ¶
func (s *RaftServer) RemoveNode(id uint64) error
type RedisService ¶
type RedisService struct {
// contains filtered or unexported fields
}
RedisService is a redis service only supports bitmap commands.
type RpcxBitmapService ¶
type RpcxBitmapService struct {
// contains filtered or unexported fields
}
RpcxBitmapService provides the rpcx service for Bitmaps.
func (*RpcxBitmapService) Add ¶
func (s *RpcxBitmapService) Add(ctx context.Context, req *BitmapValueRequest, reply *bool) error
Add adds a value in the bitmap with name.
func (*RpcxBitmapService) AddMany ¶
func (s *RpcxBitmapService) AddMany(ctx context.Context, req *BitmapValuesRequest, reply *bool) error
AddMany adds multiple values in the bitmap with name.
func (*RpcxBitmapService) AddNode ¶
func (s *RpcxBitmapService) AddNode(ctx context.Context, req *AddNodeRequest, reply *bool) error
AddNode adds a raft node.
func (*RpcxBitmapService) ClearBitmap ¶
ClearBitmap clears the bitmap and set it to be empty.
func (*RpcxBitmapService) Diff ¶
func (s *RpcxBitmapService) Diff(ctx context.Context, names *BitmapPairRequest, reply *[]uint32) error
Diff gets the difference between two bitmaps.
func (*RpcxBitmapService) DiffStore ¶
func (s *RpcxBitmapService) DiffStore(ctx context.Context, names *BitmapDstAndPairRequest, reply *bool) error
DiffStore gets the difference between two bitmaps and stores into destination.
func (*RpcxBitmapService) Exists ¶
func (s *RpcxBitmapService) Exists(ctx context.Context, req *BitmapValueRequest, reply *bool) error
Exists checks whether the value exists.
func (*RpcxBitmapService) InterStore ¶
func (s *RpcxBitmapService) InterStore(ctx context.Context, req *BitmapStoreRequest, reply *bool) error
InterStore gets the intersection of bitmaps and stores into destination.
func (*RpcxBitmapService) Remove ¶
func (s *RpcxBitmapService) Remove(ctx context.Context, req *BitmapValueRequest, reply *bool) error
Remove removes a value in the bitmap with name.
func (*RpcxBitmapService) RemoveBitmap ¶
RemoveBitmap removes the bitmap.
func (*RpcxBitmapService) RemoveNode ¶
RemoveNode removes a raft node.
func (*RpcxBitmapService) UnionStore ¶
func (s *RpcxBitmapService) UnionStore(ctx context.Context, req *BitmapStoreRequest, reply *bool) error
UnionStore gets the union of bitmaps and stores into destination.
func (*RpcxBitmapService) Xor ¶
func (s *RpcxBitmapService) Xor(ctx context.Context, names *BitmapPairRequest, reply *[]uint32) error
Xor gets the symmetric difference between bitmaps.
func (*RpcxBitmapService) XorStore ¶
func (s *RpcxBitmapService) XorStore(ctx context.Context, names *BitmapDstAndPairRequest, reply *bool) error
XorStore gets the symmetric difference between bitmaps and stores into destination.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the bitmap server that supports multiple services.
func NewServer ¶
func NewServer(addr string, bitmaps *Bitmaps, rpcxOptions []ConfigRpcxOption, persistFile string) *Server
NewServer returns a server.
func (*Server) SetConfChangeCallback ¶
func (s *Server) SetConfChangeCallback(confChangeCallback ConfChange)
SetConfChangeCallback must invoke before Serve.