Documentation ¶
Index ¶
- Constants
- func GetKey(c *clientv3.Client, key string, timeout time.Duration) (string, error)
- type DataSet
- type Error
- type ErrorType
- type EtcdClient
- type InMemStore
- type Service
- func (s *Service) AddDataSet(ctx context.Context, in *pb.DataSet) (*pb.RPCRet, error)
- func (s *Service) Barrier(ctx context.Context, in *pb.BarrierRequest) (*pb.ClusterResponse, error)
- func (s *Service) GetCluster(ctx context.Context, in *pb.ClusterRequest) (*pb.ClusterResponse, error)
- func (s *Service) GetSubDataSet(context.Context, *pb.SubDataSetRequest) (*pb.SubDataSetResponse, error)
- func (s *Service) GetTask(context.Context, *pb.TaskRequest) (*pb.TaskResponse, error)
- func (s *Service) NewEpoch(ctx context.Context, in *pb.NewEpochRequest) (*pb.RPCRet, error)
- func (s *Service) ReportChunks(ctx context.Context, in *pb.DataServerChunk) (*pb.RPCRet, error)
- func (s *Service) SetDataSet(globPaths []string, _ *int) error
- func (s *Service) TaskErrored(ctx context.Context, in *pb.Tasks) (*pb.RPCRet, error)
- func (s *Service) TaskFailed(meta pb.TaskMeta, dummy *int) error
- func (s *Service) TaskFinished(ctx context.Context, in *pb.Tasks) (*pb.RPCRet, error)
- type Store
Constants ¶
const ( // DefaultLockPath is the default etcd master lock path. DefaultLockPath = "/master/lock" // DefaultStatePath is the default etcd key for master state. DefaultStatePath = "/master/state" // DefaultAddrPath is the default etcd key for master address. DefaultAddrPath = "/master/addr" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DataSet ¶
type DataSet struct {
Files []fileDataSet
}
DataSet represents a file list dataset.
func NewDataSet ¶
NewDataSet constructs a new DataSet.
type Error ¶
Error implements Error interface
func DuplicateInitDataSet ¶
DuplicateInitDataSet make the correspond error.
type ErrorType ¶
type ErrorType string
ErrorType is the typei name of error.
const ( // ErrorTypeDuplicateInitDataSet is used to reported dataset error. ErrorTypeDuplicateInitDataSet ErrorType = "DuplicateInitDataSet" )
type EtcdClient ¶
type EtcdClient struct {
// contains filtered or unexported fields
}
EtcdClient is the etcd client that the master uses for fault tolerance and service registry.
func NewEtcdClient ¶
func NewEtcdClient(endpoints []string, addr string, lockPath, addrPath, statePath string, ttlSec int) (*EtcdClient, error)
NewEtcdClient creates a new EtcdClient.
func (*EtcdClient) Load ¶
func (e *EtcdClient) Load() ([]byte, error)
Load loads the state from etcd.
func (*EtcdClient) Save ¶
func (e *EtcdClient) Save(state []byte) error
Save saves the state into the etcd.
func (*EtcdClient) Shutdown ¶
func (e *EtcdClient) Shutdown() error
Shutdown shuts down the etcd client gracefully.
type InMemStore ¶
type InMemStore struct {
// contains filtered or unexported fields
}
InMemStore is an in memory implementation of Store interface.
It does not tolerate the fault that causes the program to crash.
func (*InMemStore) Load ¶
func (m *InMemStore) Load() ([]byte, error)
Load loads the state from the in-memory store.
func (*InMemStore) Save ¶
func (m *InMemStore) Save(state []byte) error
Save saves the state into the in-memory store.
func (*InMemStore) Shutdown ¶
func (m *InMemStore) Shutdown() error
Shutdown shuts down the in mem store.
type Service ¶
type Service struct { Chunks map[string][]pb.Chunk // DataServerID->ChunksArray // contains filtered or unexported fields }
Service is the master server service.
func NewService ¶
NewService creates a new service.
func (*Service) AddDataSet ¶
AddDataSet adds a initial dataset to service.
func (*Service) Barrier ¶
func (s *Service) Barrier(ctx context.Context, in *pb.BarrierRequest) (*pb.ClusterResponse, error)
Barrier implementes the proto interface.
func (*Service) GetCluster ¶
func (s *Service) GetCluster(ctx context.Context, in *pb.ClusterRequest) (*pb.ClusterResponse, error)
GetCluster gets cluster elements from the service.
func (*Service) GetSubDataSet ¶
func (s *Service) GetSubDataSet(context.Context, *pb.SubDataSetRequest) (*pb.SubDataSetResponse, error)
GetSubDataSet implements the proto interface.
func (*Service) GetTask ¶
func (s *Service) GetTask(context.Context, *pb.TaskRequest) (*pb.TaskResponse, error)
GetTask gets a new task from the service. passID is the client side pass count
func (*Service) ReportChunks ¶
ReportChunks implementes the proto interface.
func (*Service) SetDataSet ¶
SetDataSet implements the proto interface.
func (*Service) TaskErrored ¶
TaskErrored reports a new tasks error to the service.
func (*Service) TaskFailed ¶
TaskFailed tells the service that a task is failed.