storing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHandler

func MakeHandler(s Service) http.Handler

MakeHandler returns a http.Handler that uses the storing.Service to make the http calls, it links eac http endpoint to a storing.Service method

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

	// 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) (vID string, err 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

func New

func New(cfg *config.Config, m Membership, logger kitlog.Logger) (Service, error)

New returns an implementation of the Node with the given parameters

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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