cluster

package
v0.0.0-...-b4d98a6 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_cluster_api_proto protoreflect.FileDescriptor

Functions

func GetTopNKeysInRangeAll

func GetTopNKeysInRangeAll(minKey, maxKey int64, topN int)

GetTopNKeysInRangeAll 一次性计算所有文件 block,用于验证 GetTopNKeysInRangeBlocked 分块计算的正确性

func GetTopNKeysInRangeBlocked

func GetTopNKeysInRangeBlocked(minKey, maxKey int64, topN int, failRate float32)

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) Descriptor() ([]byte, []int)

Deprecated: Use DataBlock.ProtoReflect.Descriptor instead.

func (*DataBlock) GetBlockIndex

func (x *DataBlock) GetBlockIndex() int64

func (*DataBlock) GetFilename

func (x *DataBlock) GetFilename() string

func (*DataBlock) ProtoMessage

func (*DataBlock) ProtoMessage()

func (*DataBlock) ProtoReflect

func (x *DataBlock) ProtoReflect() protoreflect.Message

func (*DataBlock) Reset

func (x *DataBlock) Reset()

func (*DataBlock) String

func (x *DataBlock) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use KeyRange.ProtoReflect.Descriptor instead.

func (*KeyRange) GetMaxKey

func (x *KeyRange) GetMaxKey() int64

func (*KeyRange) GetMinKey

func (x *KeyRange) GetMinKey() int64

func (*KeyRange) ProtoMessage

func (*KeyRange) ProtoMessage()

func (*KeyRange) ProtoReflect

func (x *KeyRange) ProtoReflect() protoreflect.Message

func (*KeyRange) Reset

func (x *KeyRange) Reset()

func (*KeyRange) String

func (x *KeyRange) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetData

func (x *Record) GetData() []byte

func (*Record) GetKey

func (x *Record) GetKey() int64

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) ProtoReflect

func (x *Record) ProtoReflect() protoreflect.Message

func (*Record) Reset

func (x *Record) Reset()

func (*Record) String

func (x *Record) String() string

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) TopNInBlock

type Worker

type Worker struct {
	WorkerChan chan Worker // 将自己放入 WorkerChan,表示空闲
	JobChan    chan Job    // 从 JobChan 中接收任务并执行
	ResultChan chan Result // 将任务执行结果放入 ResultChan
	StopChan   chan bool   // 接收到 StopChan 的信号后,停止当前 Worker
	Client     *TopNClient // gRPC client,请求对应 mapper 节点执行实际计算任务
}

func (*Worker) Start

func (w *Worker) Start()

func (*Worker) Stop

func (w *Worker) Stop()

Jump to

Keyboard shortcuts

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