collaborator

package
v0.0.0-...-9bd2c4f Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: BSD-3-Clause Imports: 29 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MAX_IDLE_CONNECTIONS int           = 20
	REQUEST_TIMEOUT      time.Duration = 5
	UPDATE_INTERVAL      time.Duration = 1
)

Variables

This section is empty.

Functions

func Delay

func Delay(sec time.Duration)

func LaunchServer

func LaunchServer(addr string, wkb iworkable.Workable)

Types

type Case

type Case struct {
	CaseID string `json:"caseid,omitempty"`
	*Exposed
	*Reserved
}

A central collection of Collaborators across the cluster.

func (*Case) Action

func (c *Case) Action()

func (*Case) GetCluster

func (c *Case) GetCluster() string

func (*Case) GetDigest

func (c *Case) GetDigest() iremote.IDigest

func (*Case) HandleMessage

func (c *Case) HandleMessage(in *message.CardMessage) (*message.CardMessage, error)

func (*Case) ReturnByPos

func (c *Case) ReturnByPos(pos int) *card.Card

func (*Case) Stamp

func (c *Case) Stamp() *Case

func (*Case) Terminate

func (c *Case) Terminate(key string) *Case

func (*Case) Update

func (c *Case) Update(dgst iremote.IDigest)

func (*Case) Validate

func (c *Case) Validate(in *message.CardMessage, out *message.CardMessage) error

type Collaborator

type Collaborator struct {
	CardCase Case
	Workable iworkable.Workable
}

Collaborator is a helper struct to operate on any inner trxs.

func NewCollaborator

func NewCollaborator() *Collaborator

Return an instance of Collaborator

func (*Collaborator) Catchup

func (clbt *Collaborator) Catchup()

Catchup with peer servers.

func (*Collaborator) Clean

func (clbt *Collaborator) Clean()

Clean up the case, release terminated servers.

func (*Collaborator) DelayExecute

func (clbt *Collaborator) DelayExecute(t *task.Task) chan *task.Task

Execute the tasks after satisfying some certain conditions.

func (*Collaborator) DistributeSeq

func (clbt *Collaborator) DistributeSeq(sources map[int]*task.Task) (map[int]*task.Task, error)

Distribute tasks to peer servers, the tasks will be sequentially sent.

func (*Collaborator) Handle

func (clbt *Collaborator) Handle(router *mux.Router) *mux.Router

Start handling server routes.

func (*Collaborator) HandleLocal

func (clbt *Collaborator) HandleLocal(router *mux.Router, jobFunc *store.JobFunc)

Handle local Job routes.

func (*Collaborator) HandleShared

func (clbt *Collaborator) HandleShared(router *mux.Router, jobFunc *store.JobFunc)

Handle shared Job routes.

func (*Collaborator) Join

func (clbt *Collaborator) Join(wk iworkable.Workable)

Join a master to the collaborator network.

func (*Collaborator) LocalDistribute

func (clbt *Collaborator) LocalDistribute(pmaps *map[int]*task.Task, stacks []string) error

The function will process the tasks locally.

func (*Collaborator) SharedDistribute

func (clbt *Collaborator) SharedDistribute(pmaps *map[int]*task.Task, stacks []string) error

The function will process the tasks globally within the cluster network.

type Exposed

type Exposed struct {
	Cards     map[string]*card.Card `json:"cards,omitempty"`
	TimeStamp int64                 `json:"timestamp,omitempty"`
}

The exposed card addresses.

type Reserved

type Reserved struct {
	// local is the Card of localhost
	Local       card.Card `json:"local,omitempty"`
	Coordinator card.Card `json:"coordinator,omitempty"`
}

The reserved card addresses.

type ServiceClientStub

type ServiceClientStub struct {
	RPCServiceClient
}

func NewServiceClientStub

func NewServiceClientStub(endpoint string, port int32, secure ...bool) (stub *ServiceClientStub, err error)

func (*ServiceClientStub) DistributeAsync

func (stub *ServiceClientStub) DistributeAsync(source *map[int]*task.Task) chan *task.Task

func (*ServiceClientStub) Exchange

type ServiceServerStub

type ServiceServerStub struct {
	// contains filtered or unexported fields
}

func NewServiceServerStub

func NewServiceServerStub(wk iworkable.Workable) *ServiceServerStub

func (*ServiceServerStub) Distribute

func (stub *ServiceServerStub) Distribute(
	ctx context.Context,
	in *task.TaskPayload) (out *task.TaskPayload, err error)

Local implementation of rpc method Distribute()

func (*ServiceServerStub) Exchange

Directories

Path Synopsis
Package services is a generated protocol buffer package.
Package services is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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