Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClusterFull = volume.ErrClusterFull
ErrClusterFull is returned by CreateFile when no volume in the cluster has enough capacity to store the incoming file.
Functions ¶
This section is empty.
Types ¶
type Membership ¶
type Membership interface {
// Nodes return all the Nodes of the cluster except the current one
Nodes() []*client.Client
// NodesWithoutVolumeIDs return all the Nodes of the cluster except the current one that
// do not have any of the provided vids
NodesWithoutVolumeIDs(vids []string) []*client.Client
// LocalVolumes returns only the local volumes
LocalVolumes() []volume.Local
// GetNodeWithVolumeByID returns the Node that has the
// vid in his volumes
GetNodeWithVolumeByID(vid string) (*client.Client, error)
// GetNodeState returns the Staet of the Node
GetNodeState(nn string) (*membership.State, error)
// RemovedVolumeIDs returns a list of are the volumeIDs
// that left the cluster
RemovedVolumeIDs() []string
// NodesWithCapacity returns all peer nodes that have at least one volume
// with enough gossip-reported free space to store size bytes.
// Results may be stale by one gossip round; callers must handle ErrNoSpace.
NodesWithCapacity(size int64) []*client.Client
// SetDraining marks this node as draining in the cluster state,
// causing peers to skip routing writes to it.
SetDraining(draining bool)
// AllVolumeIDs returns a flat deduplicated slice of all volume IDs known
// to this node: local volumes plus all running remote nodes' volumes.
AllVolumeIDs() []string
// Leave makes it leave the cluster
Leave()
}
Membership is the interface that hides the logic behind the cluseter members. In this "domain" (rebost), the members are considered volume.Volume.
type Service ¶
type Service interface {
volume.Volume
// Config returns the current Service configuration
Config(context.Context) (*config.Config, error)
// CreateReplica creates a new File replica
CreateReplica(ctx context.Context, key string, reader io.ReadCloser, ttl time.Duration, ca time.Time) (vID string, err error)
// Drain gracefully decommissions this node by ensuring all locally-held files
// have enough replicas on other nodes, then purging local copies and leaving
// the cluster.
Drain(ctx context.Context) error
// GetReplicaInfo returns the VolumeIDs and replica count for a file.
// It searches local volumes and returns the first match.
GetReplicaInfo(ctx context.Context, key string) ([]string, int, error)
// Ready checks whether all local volumes are accessible.
// Returns nil if all volumes respond to GetState without error.
Ready(ctx context.Context) error
}
Service is the interface of used to for the storing, it's the one that will be used when defining a client to consume the API
Source Files
¶
Click to show internal directories.
Click to hide internal directories.