worker

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: Apache-2.0 Imports: 38 Imported by: 0

README

To update the protocol buffer definitions, run this from one directory above:

protoc -I worker worker/payload.proto --gofast_out=plugins=grpc:worker

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

View Source
const (
	// MB represents a megabyte.
	MB = 1 << 20
)

Variables

View Source
var (
	ErrInvalidLengthPayload = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowPayload   = fmt.Errorf("proto: integer overflow")
)
View Source
var BackupPayload_Status_name = map[int32]string{
	0: "NONE",
	1: "SUCCESS",
	2: "DUPLICATE",
	3: "FAILED",
}
View Source
var BackupPayload_Status_value = map[string]int32{
	"NONE":      0,
	"SUCCESS":   1,
	"DUPLICATE": 2,
	"FAILED":    3,
}

Functions

func AssignUidsOverNetwork added in v0.7.0

func AssignUidsOverNetwork(ctx context.Context, umap map[string]uint64) error

AssignUidsOverNetwork assigns new uids and writes them to the umap.

func BackupOverNetwork added in v0.7.0

func BackupOverNetwork(ctx context.Context) error

func Init

func Init(ps *store.Store)

func MutateOverNetwork

func MutateOverNetwork(ctx context.Context, m *task.Mutations) error

MutateOverNetwork checks which group should be running the mutations according to fingerprint of the predicate and sends it to that instance.

func ProcessTaskOverNetwork

func ProcessTaskOverNetwork(ctx context.Context, q *task.Query) (*task.Result, error)

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 RegisterWorkerServer

func RegisterWorkerServer(s *grpc.Server, srv WorkerServer)

func RunServer added in v0.7.0

func RunServer()

runServer initializes a tcp server on port which listens to requests from other workers for internal communication.

func SortOverNetwork added in v0.7.0

func SortOverNetwork(ctx context.Context, q *task.Sort) (*task.SortResult, error)

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.

func StoreStats added in v0.7.0

func StoreStats() string

StoreStats returns stats for data store.

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

func (*Payload) Marshal added in v0.4.3

func (m *Payload) Marshal() (data []byte, err error)

func (*Payload) MarshalTo added in v0.4.3

func (m *Payload) MarshalTo(data []byte) (int, error)

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) Reset

func (m *Payload) Reset()

func (*Payload) Size added in v0.4.3

func (m *Payload) Size() (n int)

func (*Payload) String

func (m *Payload) String() string

func (*Payload) Unmarshal added in v0.4.3

func (m *Payload) Unmarshal(data []byte) error

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)
	PredicateData(ctx context.Context, in *task.GroupKeys, opts ...grpc.CallOption) (Worker_PredicateDataClient, error)
	Sort(ctx context.Context, in *task.Sort, opts ...grpc.CallOption) (*task.SortResult, 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)
	PredicateData(*task.GroupKeys, Worker_PredicateDataServer) error
	Sort(context.Context, *task.Sort) (*task.SortResult, 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)
}

type Worker_PredicateDataClient added in v0.4.4

type Worker_PredicateDataClient interface {
	Recv() (*task.KV, error)
	grpc.ClientStream
}

type Worker_PredicateDataServer added in v0.4.4

type Worker_PredicateDataServer interface {
	Send(*task.KV) error
	grpc.ServerStream
}

Jump to

Keyboard shortcuts

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