controller

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoBackend = errors.New("No backend available")
)

Functions

func IsSnapShotExist

func IsSnapShotExist(snapName string, addr string) (bool, error)

IsSnapShotExist verifies whether snapshot with the given name already exists in the given replica.

Types

type BackendError

type BackendError struct {
	Errors map[string]error
}

func (*BackendError) Error

func (b *BackendError) Error() string

type BuildOpts

type BuildOpts func(*Controller)

BuildOpts is used for passing various args to NewController

func WithBackend

func WithBackend(factory types.BackendFactory) BuildOpts

WithBackend initialize backend for controller (remote R/W)

func WithClusterIP

func WithClusterIP(ip string) BuildOpts

WithClusterIP set the clusterIP

func WithFrontend

func WithFrontend(frontend types.Frontend, frontendIP string) BuildOpts

WithFrontend initialize frontend(gotgt) for controller

func WithName

func WithName(name string) BuildOpts

WithName set the volume name

func WithRF

func WithRF(rf int) BuildOpts

WithRF set the replication factor in controller

type Controller

type Controller struct {
	sync.RWMutex
	Name string

	ReplicationFactor int
	RWReplicaCount    int

	RegisteredReplicas       map[string]types.RegReplica
	RegisteredQuorumReplicas map[string]types.RegReplica
	MaxRevReplica            string
	StartTime                time.Time
	StartSignalled           bool
	ReadOnly                 bool
	SnapshotName             string
	IsSnapDeletionInProgress bool
	Checkpoint               string
	// contains filtered or unexported fields
}

func NewController

func NewController(opts ...BuildOpts) *Controller

NewController instantiates a new Controller

func (*Controller) AddQuorumReplica

func (c *Controller) AddQuorumReplica(address string) error

func (*Controller) AddReplica

func (c *Controller) AddReplica(address string) error

func (*Controller) Close

func (c *Controller) Close() error

func (*Controller) DeleteSnapshot

func (c *Controller) DeleteSnapshot(snapshot string, replicas []types.Replica) error

DeleteSnapshot ...

func (*Controller) GetSize

func (c *Controller) GetSize() int64

func (*Controller) IsReplicaRW

func (c *Controller) IsReplicaRW(replicaInController *types.Replica) error

func (*Controller) ListQuorumReplicas

func (c *Controller) ListQuorumReplicas() []types.Replica

func (*Controller) ListReplicas

func (c *Controller) ListReplicas() []types.Replica

func (*Controller) PrepareRebuildReplica

func (c *Controller) PrepareRebuildReplica(address string) ([]string, error)

func (*Controller) ReadAt

func (c *Controller) ReadAt(b []byte, off int64) (int, error)

func (*Controller) RegisterReplica

func (c *Controller) RegisterReplica(register types.RegReplica) error

func (*Controller) RemoveReplica

func (c *Controller) RemoveReplica(address string) error

func (*Controller) RemoveReplicaNoLock

func (c *Controller) RemoveReplicaNoLock(address string) error

func (*Controller) Resize

func (c *Controller) Resize(name string, size string) error

func (*Controller) Revert

func (c *Controller) Revert(name string) error

func (*Controller) SetReplicaMode

func (c *Controller) SetReplicaMode(address string, mode types.Mode) error

func (*Controller) Shutdown

func (c *Controller) Shutdown() error

func (*Controller) Size

func (c *Controller) Size() (int64, error)

func (*Controller) Snapshot

func (c *Controller) Snapshot(name string) (string, error)

func (*Controller) Start

func (c *Controller) Start(addresses ...string) error

func (*Controller) Stats

func (c *Controller) Stats() (types.Stats, error)

func (*Controller) Sync

func (c *Controller) Sync() (int, error)

func (*Controller) Unmap

func (c *Controller) Unmap(offset int64, length int64) (int, error)

func (*Controller) UpdateCheckpoint added in v1.12.1

func (c *Controller) UpdateCheckpoint()

UpdateCheckpoint updates c.Checkpoint based on the last snapshot. This function should be called after every removal/addition of replicas. GetLatestSnapshot and SetCheckpoint will error out in cases when one of the replicas go down in which case we should unset c.Checkpoint Checkpoint should be set only when replication factor number of replicas are in RW state

func (*Controller) UpdateVolStatus

func (c *Controller) UpdateVolStatus()

func (*Controller) VerifyRebuildReplica

func (c *Controller) VerifyRebuildReplica(address string) error

func (*Controller) WriteAt

func (c *Controller) WriteAt(b []byte, off int64) (int, error)

WriteAt is the interface which can be used to write data to jiva volumes Delaying error response by 1 second when volume is in read only state, this will avoid the iscsi disk at client side to go in read only mode even when IOs are not being served. Above approach can hold the the app only for small amount of time based on the app.

type MultiWriterAt

type MultiWriterAt struct {
	// contains filtered or unexported fields
}

func (*MultiWriterAt) Sync

func (m *MultiWriterAt) Sync() (int, error)

func (*MultiWriterAt) Unmap

func (m *MultiWriterAt) Unmap(offset int64, length int64) (int, error)

func (*MultiWriterAt) WriteAt

func (m *MultiWriterAt) WriteAt(p []byte, off int64) (n int, err error)

type MultiWriterError

type MultiWriterError struct {
	Writers       []Writer
	Updaters      []Writer
	ReplicaErrors []error
	QuorumErrors  []error
}

func (*MultiWriterError) Error

func (m *MultiWriterError) Error() string

type Writer

type Writer interface {
	io.WriterAt
	Sync() (int, error)
	Unmap(int64, int64) (int, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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