Documentation ¶
Overview ¶
Package worker is a generated protocol buffer package. It is generated from these files: worker/payload.proto It has these top-level messages: Payload BackupPayload
Package worker contains code for internal worker communication to perform queries and mutations.
Index ¶
- Constants
- Variables
- func Aggregate(agrtr string, values []*task.Value, typ types.TypeID) (*task.Value, error)
- func AssignUidsOverNetwork(ctx context.Context, umap map[string]uint64) error
- func BackupOverNetwork(ctx context.Context) error
- func BlockingStop()
- func CouldApplyAggregatorOn(agrtr string, typ types.TypeID) bool
- func EvalCompare(cmp string, lv, rv int64) bool
- func Init(ps *store.Store)
- func MutateOverNetwork(ctx context.Context, m *task.Mutations) error
- func ProcessTaskOverNetwork(ctx context.Context, q *task.Query) (*task.Result, error)
- func RebuildIndexOverNetwork(ctx context.Context, attr string) error
- func RegisterWorkerServer(s *grpc.Server, srv WorkerServer)
- func RunServer(bindall bool)
- func SortOverNetwork(ctx context.Context, q *task.Sort) (*task.SortResult, error)
- func StartRaftNodes(walDir string)
- func StoreStats() string
- type BackupPayload
- func (*BackupPayload) Descriptor() ([]byte, []int)
- func (m *BackupPayload) GetGroupId() uint32
- func (m *BackupPayload) GetReqId() uint64
- func (m *BackupPayload) GetStatus() BackupPayload_Status
- func (m *BackupPayload) Marshal() (dAtA []byte, err error)
- func (m *BackupPayload) MarshalTo(dAtA []byte) (int, error)
- func (*BackupPayload) ProtoMessage()
- func (m *BackupPayload) Reset()
- func (m *BackupPayload) Size() (n int)
- func (m *BackupPayload) String() string
- func (m *BackupPayload) Unmarshal(dAtA []byte) error
- type BackupPayload_Status
- type FuncType
- type Payload
- func (*Payload) Descriptor() ([]byte, []int)
- func (m *Payload) GetData() []byte
- func (m *Payload) Marshal() (dAtA []byte, err error)
- func (m *Payload) MarshalTo(dAtA []byte) (int, error)
- func (*Payload) ProtoMessage()
- func (m *Payload) Reset()
- func (m *Payload) Size() (n int)
- func (m *Payload) String() string
- func (m *Payload) Unmarshal(dAtA []byte) error
- type WorkerClient
- type WorkerServer
- type Worker_PredicateAndSchemaDataClient
- type Worker_PredicateAndSchemaDataServer
Constants ¶
const (
// MB represents a megabyte.
MB = 1 << 20
)
Variables ¶
var ( ErrInvalidLengthPayload = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPayload = fmt.Errorf("proto: integer overflow") )
var BackupPayload_Status_name = map[int32]string{
0: "NONE",
1: "SUCCESS",
2: "DUPLICATE",
3: "FAILED",
}
var BackupPayload_Status_value = map[string]int32{
"NONE": 0,
"SUCCESS": 1,
"DUPLICATE": 2,
"FAILED": 3,
}
Functions ¶
func AssignUidsOverNetwork ¶ added in v0.7.0
AssignUidsOverNetwork assigns new uids and writes them to the umap.
func BackupOverNetwork ¶ added in v0.7.0
func BlockingStop ¶ added in v0.7.3
func BlockingStop()
BlockingStop stops all the nodes, server between other workers and syncs all marks.
func CouldApplyAggregatorOn ¶ added in v0.7.3
func EvalCompare ¶ added in v0.7.3
func MutateOverNetwork ¶
MutateOverNetwork checks which group should be running the mutations according to fingerprint of the predicate and sends it to that instance.
func ProcessTaskOverNetwork ¶
ProcessTaskOverNetwork is used to process the query and get the result from the instance which stores posting list corresponding to the predicate in the query.
func RebuildIndexOverNetwork ¶ added in v0.7.2
RebuildIndexOverNetwork rebuilds index for attr. If it serves the attr, then it will rebuild index. Otherwise, it will send a request to a server that serves the attr.
func RegisterWorkerServer ¶
func RegisterWorkerServer(s *grpc.Server, srv WorkerServer)
func RunServer ¶ added in v0.7.0
func RunServer(bindall bool)
RunServer initializes a tcp server on port which listens to requests from other workers for internal communication.
func SortOverNetwork ¶ added in v0.7.0
SortOverNetwork sends sort query over the network.
func StartRaftNodes ¶ added in v0.7.0
func StartRaftNodes(walDir string)
StartRaftNodes will read the WAL dir, create the RAFT groups, and either start or restart RAFT nodes. This function triggers RAFT nodes to be created, and is the entrace to the RAFT world from main.go.
Types ¶
type BackupPayload ¶ added in v0.7.0
type BackupPayload struct { ReqId uint64 `protobuf:"varint,1,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` GroupId uint32 `protobuf:"varint,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` Status BackupPayload_Status `protobuf:"varint,3,opt,name=status,proto3,enum=worker.BackupPayload_Status" json:"status,omitempty"` }
BackupPayload is used both as a request and a response. When used in request, groups represents the list of groups that need to be backed up. When used in response, groups represent the list of groups that were backed up.
func (*BackupPayload) Descriptor ¶ added in v0.7.0
func (*BackupPayload) Descriptor() ([]byte, []int)
func (*BackupPayload) GetGroupId ¶ added in v0.7.1
func (m *BackupPayload) GetGroupId() uint32
func (*BackupPayload) GetReqId ¶ added in v0.7.1
func (m *BackupPayload) GetReqId() uint64
func (*BackupPayload) GetStatus ¶ added in v0.7.1
func (m *BackupPayload) GetStatus() BackupPayload_Status
func (*BackupPayload) Marshal ¶ added in v0.7.0
func (m *BackupPayload) Marshal() (dAtA []byte, err error)
func (*BackupPayload) MarshalTo ¶ added in v0.7.0
func (m *BackupPayload) MarshalTo(dAtA []byte) (int, error)
func (*BackupPayload) ProtoMessage ¶ added in v0.7.0
func (*BackupPayload) ProtoMessage()
func (*BackupPayload) Reset ¶ added in v0.7.0
func (m *BackupPayload) Reset()
func (*BackupPayload) Size ¶ added in v0.7.0
func (m *BackupPayload) Size() (n int)
func (*BackupPayload) String ¶ added in v0.7.0
func (m *BackupPayload) String() string
func (*BackupPayload) Unmarshal ¶ added in v0.7.0
func (m *BackupPayload) Unmarshal(dAtA []byte) error
type BackupPayload_Status ¶ added in v0.7.0
type BackupPayload_Status int32
const ( BackupPayload_NONE BackupPayload_Status = 0 BackupPayload_SUCCESS BackupPayload_Status = 1 BackupPayload_DUPLICATE BackupPayload_Status = 2 BackupPayload_FAILED BackupPayload_Status = 3 )
func (BackupPayload_Status) EnumDescriptor ¶ added in v0.7.0
func (BackupPayload_Status) EnumDescriptor() ([]byte, []int)
func (BackupPayload_Status) String ¶ added in v0.7.0
func (x BackupPayload_Status) String() string
type Payload ¶
type Payload struct {
Data []byte `protobuf:"bytes,1,opt,name=Data,json=data,proto3" json:"Data,omitempty"`
}
func (*Payload) Descriptor ¶
func (*Payload) ProtoMessage ¶
func (*Payload) ProtoMessage()
type WorkerClient ¶
type WorkerClient interface { // Connection testing RPC. Echo(ctx context.Context, in *Payload, opts ...grpc.CallOption) (*Payload, error) // Data serving RPCs. AssignUids(ctx context.Context, in *task.Num, opts ...grpc.CallOption) (*task.List, error) Mutate(ctx context.Context, in *task.Mutations, opts ...grpc.CallOption) (*Payload, error) ServeTask(ctx context.Context, in *task.Query, opts ...grpc.CallOption) (*task.Result, error) PredicateAndSchemaData(ctx context.Context, opts ...grpc.CallOption) (Worker_PredicateAndSchemaDataClient, error) Sort(ctx context.Context, in *task.Sort, opts ...grpc.CallOption) (*task.SortResult, error) RebuildIndex(ctx context.Context, in *task.RebuildIndex, opts ...grpc.CallOption) (*Payload, error) // RAFT serving RPCs. RaftMessage(ctx context.Context, in *Payload, opts ...grpc.CallOption) (*Payload, error) JoinCluster(ctx context.Context, in *task.RaftContext, opts ...grpc.CallOption) (*Payload, error) UpdateMembership(ctx context.Context, in *task.MembershipUpdate, opts ...grpc.CallOption) (*task.MembershipUpdate, error) Backup(ctx context.Context, in *BackupPayload, opts ...grpc.CallOption) (*BackupPayload, error) }
func NewWorkerClient ¶
func NewWorkerClient(cc *grpc.ClientConn) WorkerClient
type WorkerServer ¶
type WorkerServer interface { // Connection testing RPC. Echo(context.Context, *Payload) (*Payload, error) // Data serving RPCs. AssignUids(context.Context, *task.Num) (*task.List, error) Mutate(context.Context, *task.Mutations) (*Payload, error) ServeTask(context.Context, *task.Query) (*task.Result, error) PredicateAndSchemaData(Worker_PredicateAndSchemaDataServer) error Sort(context.Context, *task.Sort) (*task.SortResult, error) RebuildIndex(context.Context, *task.RebuildIndex) (*Payload, error) // RAFT serving RPCs. RaftMessage(context.Context, *Payload) (*Payload, error) JoinCluster(context.Context, *task.RaftContext) (*Payload, error) UpdateMembership(context.Context, *task.MembershipUpdate) (*task.MembershipUpdate, error) Backup(context.Context, *BackupPayload) (*BackupPayload, error) }