Documentation ¶
Index ¶
Constants ¶
const ( // PsDesired is etcd path for store desired pserver count PsDesired = "/ps_desired" // PsPath is the base dir for pserver to store their addr PsPath = "/ps/" // PsCheckpoint is the etcd path for store checkpoints information PsCheckpoint = "/checkpoints/" )
const ( AlreadyInitialized = "pserver already initialized" Uninitialized = "pserver not fully initialized" WrongChecksum = "checkpoint file checksum validation failed" )
RPC error message.
Variables ¶
var ErrCheckpointNotFound = errors.New("checkpoint not found in etcd")
ErrCheckpointNotFound indicates that the pserver checkpoint could not be found.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
type Checkpoint []parameterCheckpoint
Checkpoint is the pserver shard persist in file.
func LoadCheckpoint ¶
func LoadCheckpoint(e KVStore, idx int) (Checkpoint, error)
LoadCheckpoint loads checkpoint from file.
type ElementType ¶
type ElementType int
ElementType is the type of elements of a Parameter.
const ( Int32 ElementType = iota UInt32 Int64 UInt64 Float32 Float64 )
Supported element types.
type EtcdClient ¶
type EtcdClient struct {
// contains filtered or unexported fields
}
EtcdClient is the etcd client that the pserver uses for fault tolerance, service registry and coordination.
func NewEtcdClient ¶
func NewEtcdClient(endpoints string, numPservers int, dialtimeout time.Duration, ttlSec int) *EtcdClient
NewEtcdClient creates an EtcdClient
func (*EtcdClient) Register ¶
func (e *EtcdClient) Register(port int) (int, error)
Register registers the pserver on etcd
Register returns the index of the current pserver.
func (*EtcdClient) Shutdown ¶
func (e *EtcdClient) Shutdown() error
Shutdown shuts down the etcd client gracefully.
type Parameter ¶
type Parameter struct { Name string ElementType ElementType Content []byte }
Parameter is a piece of data to sync with the parameter server.
type ParameterWithConfig ¶
type ParameterWithConfig struct { Param Parameter Config []byte // parameter configuration in Proto Buffer format }
ParameterWithConfig contains the parameter and the configuration.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the RPC service for pserver.
func NewService ¶
func NewService(idx int, interval time.Duration, path string, client KVStore, cp Checkpoint) (*Service, error)
NewService creates a new service, will bypass etcd registration if no endpoints specified. It will recovery from checkpoint file if a exists a specified checkpoint.
func (*Service) FinishInitParams ¶
FinishInitParams tells the parameter server that the parameter initialization has finished.