dmplugin

package
v0.0.0-...-a55ed6e Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayConfig

func DisplayConfig(cfg interface{}) string

DisplayConfig formats the configuration into string for display purposes. A helper function to remove some duplicate code in movers.

func LoadConfig

func LoadConfig(cfgFile string, cfg interface{}) error

LoadConfig reads this plugin's config file and decodes it into the passed config struct.

Types

type Action

type Action interface {
	// Update sends an action status update
	Update(offset, length, max int64) error
	// ID returns the action item's ID
	ID() uint64
	// Offset returns the current offset of the action item
	Offset() int64
	// Length returns the expected length of the action item's file
	Length() int64
	// Data returns a byte slice of the action item's data
	Data() []byte
	// PrimaryPath returns the action item's primary file path
	PrimaryPath() string

	// WritePath returns the action item's write path (e.g. for restores)
	WritePath() string

	// UUID returns the action item's file id
	UUID() string

	// Hash returns the action item's file id
	Hash() []byte

	// URL returns the action item's file id
	URL() string

	// SetUUID sets the action's file id
	SetUUID(id string)

	// SetHash sets the action's file id
	SetHash(hash []byte)

	// SetURL sets the action's file id
	SetURL(id string)

	// SetActualLength sets the action's actual file length
	SetActualLength(length int64)
}

Action defines an interface for dm actions

type ActionHandler

type ActionHandler func(Action) error

ActionHandler is function that implements one of the commands

type Archiver

type Archiver interface {
	Archive(Action) error
}

Archiver defines an interface for data movers capable of fulfilling Archive requests

type Config

type Config struct {
	Mover      Mover
	NumThreads int
	ArchiveID  uint32
}

Config defines configuration for a DatamMoverClient

type DataMoverClient

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

DataMoverClient is the data mover client to the HSM agent

func NewMover

func NewMover(plugin *Plugin, cli pb.DataMoverClient, config *Config) *DataMoverClient

NewMover returns a new *DataMoverClient

func (*DataMoverClient) Run

func (dm *DataMoverClient) Run(ctx context.Context)

Run begins listening for and processing incoming action items

type Fataler

type Fataler interface {
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
}

Fataler provides Fatal and Fatalf

type Mover

type Mover interface {
	Start()
}

Mover defines an interface for data mover implementations

type Plugin

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

Plugin manages communication between the HSM agent and the datamover

func New

func New(name string, initClient func(string) (fsroot.Client, error)) (*Plugin, error)

New returns a new *Plugin, or error

func (*Plugin) AddMover

func (a *Plugin) AddMover(config *Config)

AddMover registers a new data mover with the plugin

func (*Plugin) Base

func (a *Plugin) Base() string

Base returns the root directory for plugin.

func (*Plugin) Close

func (a *Plugin) Close() error

Close closes the connection to the agent

func (*Plugin) ConfigFile

func (a *Plugin) ConfigFile() string

ConfigFile returns path to the plugin config file.

func (*Plugin) FsName

func (a *Plugin) FsName() string

FsName returns the associated Lustre filesystem name

func (*Plugin) Run

func (a *Plugin) Run()

Run starts the data mover threads and blocks until they complete.

func (*Plugin) Stop

func (a *Plugin) Stop()

Stop signals to all registered data movers that they should stop processing and shut down

type Remover

type Remover interface {
	Remove(Action) error
}

Remover defines an interface for data movers capable of fulfilling Remove requests

type Restorer

type Restorer interface {
	Restore(Action) error
}

Restorer defines an interface for data movers capable of fulfilling Restore requests

type TestAction

type TestAction struct {
	ActualLength int
	Updates      int
	// contains filtered or unexported fields
}

TestAction is an Action implementation used for testing Movers.

func NewTestAction

func NewTestAction(t Fataler, path string, offset int64, length int64, uuid string, data []byte) *TestAction

NewTestAction returns a stub action that can be used for testing.

func (*TestAction) Complete

func (a *TestAction) Complete() error

Complete signals that the action has completed

func (*TestAction) Data

func (a *TestAction) Data() []byte

Data returns a byte slice of the action item's data

func (*TestAction) Fail

func (a *TestAction) Fail(err error) error

Fail signals that the action has failed

func (*TestAction) Hash

func (a *TestAction) Hash() []byte

Hash returns the action item's file id

func (*TestAction) ID

func (a *TestAction) ID() uint64

ID returns the action item's ID

func (*TestAction) Length

func (a *TestAction) Length() int64

Length returns the expected length of the action item's file

func (*TestAction) Offset

func (a *TestAction) Offset() int64

Offset returns the current offset of the action item

func (*TestAction) PrimaryPath

func (a *TestAction) PrimaryPath() string

PrimaryPath returns the action item's primary file path

func (*TestAction) SetActualLength

func (a *TestAction) SetActualLength(length int64)

SetActualLength sets the action's actual file length

func (*TestAction) SetHash

func (a *TestAction) SetHash(id []byte)

SetHash sets the action's file id

func (*TestAction) SetURL

func (a *TestAction) SetURL(u string)

SetURL returns the action item's file id

func (*TestAction) SetUUID

func (a *TestAction) SetUUID(u string)

SetUUID returns the action item's file id

func (*TestAction) URL

func (a *TestAction) URL() string

URL returns the action item's file id

func (*TestAction) UUID

func (a *TestAction) UUID() string

UUID returns the action item's file id

func (*TestAction) Update

func (a *TestAction) Update(offset, length, max int64) error

Update sends an action status update

func (*TestAction) WritePath

func (a *TestAction) WritePath() string

WritePath returns the action item's write path (e.g. for restores)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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