Documentation
¶
Overview ¶
TaskBuilder is also implemented by application developer and used by framework implementation so decide which task implementation one should use at any give node. It should be called only once at node initialization.
The topology is a data structure implemented by application, and used by framework implementation to setup/manage the event according to topology defined here. The main usage is: a. At beginning of the framework initialization for each task, framework
call the SetTaskID so that the singleton Topology knows which taskID it represents.
b. At beginning of each epoch, the framework implementation (on each task)
will call GetLinkTypes and GetNeighbors with given epoch, so that it knows how to setup watcher for node failures.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackedUpFramework ¶
type BackedUpFramework interface {
// Ask framework to do update on this update on this task, which consists
// of one primary and some backup copies.
Update(taskID uint64, log UpdateLog)
}
Note that framework can decide how update can be done, and how to serve the updatelog.
type Backupable ¶
type Backupable interface {
// Some hooks that need for master slave etc.
BecamePrimary()
BecameBackup()
// Framework notify this copy to update. This should be the only way that
// one update the state of copy.
Update(log UpdateLog)
}
Backupable is an interface that task need to implement if they want to have hot standby copy. This is another can of beans.
type Bootstrap ¶
type Bootstrap interface {
// These allow application developer to set the task configuration so framework
// implementation knows which task to invoke at each node.
SetTaskBuilder(taskBuilder TaskBuilder)
// This allow the application to specify how tasks are connection at each epoch
SetTopology(topology Topology)
// After all the configure is done, driver need to call start so that all
// nodes will get into the event loop to run the application.
Start()
}
This interface is used by application during taskgraph configuration phase.
type DatumIterator ¶
DatumIerator allow one to iterate through all the datum in the set.
type DatumIteratorBuilder ¶
type DatumIteratorBuilder interface {
Build(path string) DatumIterator
}
This can be used to build a sequence of Datum from source.
type DatumStore ¶
type DatumStore struct {
Cache []Datum
}
DatumStore host a set of Datum in the memory.
type DatumTransformer ¶
Transform Datum from one format to another.
type Framework ¶
type Framework interface {
// This allow the task implementation query its neighbors.
GetTopology() Topology
// Kill the framework itself.
// As epoch changes, some nodes isn't needed anymore
Kill()
// Some task can inform all participating tasks to shutdown.
// If successful, all tasks will be gracefully shutdown.
// TODO: @param status
ShutdownJob()
GetLogger() *log.Logger
// This is used to figure out taskid for current node
GetTaskID() uint64
// This is useful for task to inform the framework their status change.
// metaData has to be really small, since it might be stored in etcd.
// Set meta flag to notify meta to all nodes of linkType to this node.
FlagMeta(ctx context.Context, linkType, meta string)
// Some task can inform all participating tasks to new epoch
IncEpoch(ctx context.Context)
// Request data from task toID with specified linkType and meta.
DataRequest(ctx context.Context, toID uint64, method string, input proto.Message)
CheckGRPCContext(ctx context.Context) error
}
Framework hides distributed system complexity and provides users convenience of high level features.
type Node ¶
type Node interface {
// return the ID of this node
ID() uint64
// return the task this node associated to
TaskID() uint64
// return the status of this node
// possible status: no associated to any task
// master of a task
// slave of a task
Status() uint64
// return a connection string of this node
// scheme://host:port
Connection() string
}
type Task ¶
type Task interface {
// This is useful to bring the task up to speed from scratch or if it recovers.
Init(taskID uint64, framework Framework)
// Task is finished up for exit. Last chance to save some task specific work.
Exit()
// Framework tells user task what current epoch is.
// This give the task an opportunity to cleanup and regroup.
EnterEpoch(ctx context.Context, epoch uint64)
// The meta/data notifications obey exactly-once semantics. Note that the same
// meta string will be notified only once even if you flag the meta more than once.
// TODO: one can also get this from channel.
MetaReady(ctx context.Context, fromID uint64, linkType, meta string)
// This is the callback when data from server is ready.
DataReady(ctx context.Context, fromID uint64, method string, output proto.Message)
CreateOutputMessage(methodName string) proto.Message
CreateServer() *grpc.Server
}
All event handler functions and should be non-blocking.
type TaskBuilder ¶
type Topology ¶
type Topology interface {
// This method is called once by framework implementation. So that
// we can get the local topology for each epoch later.
SetTaskID(taskID uint64)
// This returns the type of links this topology supports
GetLinkTypes() []string
// This returns the neighbors of given link for this node at this epoch.
GetNeighbors(linkType string, epoch uint64) []uint64
}
The Topology will be implemented by the application. Each Topology might have many epochs. The topology of each epoch might be different.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
bwmf/proto
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
|
regression/demo
command
|
|
|
regression/proto
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
|
pkg
|
|
