Documentation ¶
Index ¶
- Variables
- func GetTopNKeysInRangeAll(minKey, maxKey int64, topN int)
- func GetTopNKeysInRangeBlocked(minKey, maxKey int64, topN int, failRate float32)
- func RegisterTopNServer(s *grpc.Server, srv TopNServer)
- func StartServer(serverIndex int)
- type DataBlock
- type Dispatcher
- type Job
- type KeyRange
- type Record
- type Result
- type TopNClient
- type TopNInBlockRequest
- func (*TopNInBlockRequest) Descriptor() ([]byte, []int)deprecated
- func (x *TopNInBlockRequest) GetDataBlock() *DataBlock
- func (x *TopNInBlockRequest) GetFailRate() float32
- func (x *TopNInBlockRequest) GetKeyRange() *KeyRange
- func (x *TopNInBlockRequest) GetTopN() int64
- func (*TopNInBlockRequest) ProtoMessage()
- func (x *TopNInBlockRequest) ProtoReflect() protoreflect.Message
- func (x *TopNInBlockRequest) Reset()
- func (x *TopNInBlockRequest) String() string
- type TopNInBlockResponse
- func (*TopNInBlockResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TopNInBlockResponse) GetRecords() []*Record
- func (*TopNInBlockResponse) ProtoMessage()
- func (x *TopNInBlockResponse) ProtoReflect() protoreflect.Message
- func (x *TopNInBlockResponse) Reset()
- func (x *TopNInBlockResponse) String() string
- type TopNServer
- type UnimplementedTopNServer
- type Worker
Constants ¶
This section is empty.
Variables ¶
var File_pkg_cluster_api_proto protoreflect.FileDescriptor
Functions ¶
func GetTopNKeysInRangeAll ¶
GetTopNKeysInRangeAll 一次性计算所有文件 block,用于验证 GetTopNKeysInRangeBlocked 分块计算的正确性
func GetTopNKeysInRangeBlocked ¶
GetTopNKeysInRangeBlocked 计算当前 block 内的 topN
func RegisterTopNServer ¶
func RegisterTopNServer(s *grpc.Server, srv TopNServer)
func StartServer ¶
func StartServer(serverIndex int)
Types ¶
type DataBlock ¶
type DataBlock struct { Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` BlockIndex int64 `protobuf:"varint,2,opt,name=block_index,json=blockIndex,proto3" json:"block_index,omitempty"` // contains filtered or unexported fields }
func (*DataBlock) Descriptor
deprecated
func (*DataBlock) GetBlockIndex ¶
func (*DataBlock) GetFilename ¶
func (*DataBlock) ProtoMessage ¶
func (*DataBlock) ProtoMessage()
func (*DataBlock) ProtoReflect ¶
func (x *DataBlock) ProtoReflect() protoreflect.Message
type Dispatcher ¶
type Dispatcher struct { WorkerChan chan Worker // 从 WorkerChan 中获取空闲的 Worker,将任务分配给它 JobChan chan Job // 从 driver 接收 Job,用于分配给 Worker JobRescheduleChan chan Result // 从 JobRescheduleChan 中检查 Job 结果,决定是否重新调度计算 JobResultChan chan Result // 向 driver 发送 Job 结果 StopChan chan bool // 停止信号 channel // contains filtered or unexported fields }
func NewDispatcher ¶
func NewDispatcher(clients []TopNClient, jobNum int) Dispatcher
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start()
type Job ¶
type Job struct { ID int Request *TopNInBlockRequest }
type KeyRange ¶
type KeyRange struct { MaxKey int64 `protobuf:"varint,1,opt,name=max_key,json=maxKey,proto3" json:"max_key,omitempty"` MinKey int64 `protobuf:"varint,2,opt,name=min_key,json=minKey,proto3" json:"min_key,omitempty"` // contains filtered or unexported fields }
func (*KeyRange) Descriptor
deprecated
func (*KeyRange) ProtoMessage ¶
func (*KeyRange) ProtoMessage()
func (*KeyRange) ProtoReflect ¶
func (x *KeyRange) ProtoReflect() protoreflect.Message
type Record ¶
type Record struct { Key int64 `protobuf:"varint,1,opt,name=key,proto3" json:"key,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*Record) Descriptor
deprecated
func (*Record) ProtoMessage ¶
func (*Record) ProtoMessage()
func (*Record) ProtoReflect ¶
func (x *Record) ProtoReflect() protoreflect.Message
type Result ¶
type Result struct { Job Job Response *TopNInBlockResponse Error error }
type TopNClient ¶
type TopNClient interface { TopNInBlock(ctx context.Context, in *TopNInBlockRequest, opts ...grpc.CallOption) (*TopNInBlockResponse, error) TopNAll(ctx context.Context, in *TopNInBlockRequest, opts ...grpc.CallOption) (*TopNInBlockResponse, error) }
TopNClient is the client API for TopN service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewTopNClient ¶
func NewTopNClient(cc grpc.ClientConnInterface) TopNClient
type TopNInBlockRequest ¶
type TopNInBlockRequest struct { DataBlock *DataBlock `protobuf:"bytes,1,opt,name=data_block,json=dataBlock,proto3" json:"data_block,omitempty"` KeyRange *KeyRange `protobuf:"bytes,2,opt,name=key_range,json=keyRange,proto3" json:"key_range,omitempty"` TopN int64 `protobuf:"varint,3,opt,name=top_n,json=topN,proto3" json:"top_n,omitempty"` FailRate float32 `protobuf:"fixed32,4,opt,name=fail_rate,json=failRate,proto3" json:"fail_rate,omitempty"` // contains filtered or unexported fields }
func (*TopNInBlockRequest) Descriptor
deprecated
func (*TopNInBlockRequest) Descriptor() ([]byte, []int)
Deprecated: Use TopNInBlockRequest.ProtoReflect.Descriptor instead.
func (*TopNInBlockRequest) GetDataBlock ¶
func (x *TopNInBlockRequest) GetDataBlock() *DataBlock
func (*TopNInBlockRequest) GetFailRate ¶
func (x *TopNInBlockRequest) GetFailRate() float32
func (*TopNInBlockRequest) GetKeyRange ¶
func (x *TopNInBlockRequest) GetKeyRange() *KeyRange
func (*TopNInBlockRequest) GetTopN ¶
func (x *TopNInBlockRequest) GetTopN() int64
func (*TopNInBlockRequest) ProtoMessage ¶
func (*TopNInBlockRequest) ProtoMessage()
func (*TopNInBlockRequest) ProtoReflect ¶
func (x *TopNInBlockRequest) ProtoReflect() protoreflect.Message
func (*TopNInBlockRequest) Reset ¶
func (x *TopNInBlockRequest) Reset()
func (*TopNInBlockRequest) String ¶
func (x *TopNInBlockRequest) String() string
type TopNInBlockResponse ¶
type TopNInBlockResponse struct { Records []*Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"` // contains filtered or unexported fields }
func DoRequest ¶
func DoRequest(client TopNClient, job Job) (*TopNInBlockResponse, error)
func (*TopNInBlockResponse) Descriptor
deprecated
func (*TopNInBlockResponse) Descriptor() ([]byte, []int)
Deprecated: Use TopNInBlockResponse.ProtoReflect.Descriptor instead.
func (*TopNInBlockResponse) GetRecords ¶
func (x *TopNInBlockResponse) GetRecords() []*Record
func (*TopNInBlockResponse) ProtoMessage ¶
func (*TopNInBlockResponse) ProtoMessage()
func (*TopNInBlockResponse) ProtoReflect ¶
func (x *TopNInBlockResponse) ProtoReflect() protoreflect.Message
func (*TopNInBlockResponse) Reset ¶
func (x *TopNInBlockResponse) Reset()
func (*TopNInBlockResponse) String ¶
func (x *TopNInBlockResponse) String() string
type TopNServer ¶
type TopNServer interface { TopNInBlock(context.Context, *TopNInBlockRequest) (*TopNInBlockResponse, error) TopNAll(context.Context, *TopNInBlockRequest) (*TopNInBlockResponse, error) // contains filtered or unexported methods }
TopNServer is the server API for TopN service. All implementations must embed UnimplementedTopNServer for forward compatibility
type UnimplementedTopNServer ¶
type UnimplementedTopNServer struct { }
UnimplementedTopNServer must be embedded to have forward compatible implementations.
func (*UnimplementedTopNServer) TopNAll ¶
func (*UnimplementedTopNServer) TopNAll(context.Context, *TopNInBlockRequest) (*TopNInBlockResponse, error)
func (*UnimplementedTopNServer) TopNInBlock ¶
func (*UnimplementedTopNServer) TopNInBlock(context.Context, *TopNInBlockRequest) (*TopNInBlockResponse, error)