fake

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinimumVolumeSizeBytes = 1048576 // 1 MiB

	// Constants for internal pool attributes
	Size   = "size"
	Region = "region"
	Zone   = "zone"

	// Constants for special use cases
	PVC_creating_01       = "creating-c44b-40f9-a0a2-a09172f1a1f6"
	PVC_creating_02       = "creating-686e-4960-9135-b040c2d54332"
	PVC_creating_clone_03 = "creating-382g-4ccj-k0k4-z88la30d9k22"
)

Variables

This section is empty.

Functions

func Clone

func Clone(a, b interface{})

func NewFakeStorageBackend

func NewFakeStorageBackend(
	ctx context.Context, configJSON, backendUUID string,
) (sb *storage.StorageBackend, err error)

func NewFakeStorageDriverConfigJSON

func NewFakeStorageDriverConfigJSON(
	name string, protocol tridentconfig.Protocol, pools map[string]*fake.StoragePool, volumes []fake.Volume,
) (string, error)

func NewFakeStorageDriverConfigJSONWithDebugTraceFlags

func NewFakeStorageDriverConfigJSONWithDebugTraceFlags(
	name string, protocol tridentconfig.Protocol, debugTraceFlags map[string]bool, storagePrefix string,
) (string, error)

func NewFakeStorageDriverConfigJSONWithVirtualPools

func NewFakeStorageDriverConfigJSONWithVirtualPools(
	name string, protocol tridentconfig.Protocol, pools map[string]*fake.StoragePool,
	vpool drivers.FakeStorageDriverPool, vpools []drivers.FakeStorageDriverPool,
) (string, error)

Types

type StorageDriver

type StorageDriver struct {
	Config drivers.FakeStorageDriverConfig

	// Volumes saves info about Volumes created on this driver
	Volumes map[string]fake.Volume

	// CreatingVolumes is used to test VolumeCreatingTransactions
	CreatingVolumes map[string]fake.CreatingVolume

	// DestroyedVolumes is here so that tests can check whether destroy
	// has been called on a volume during or after bootstrapping, since
	// different driver instances with the same config won't actually share
	// state.
	DestroyedVolumes map[string]bool

	// Snapshots saves info about Snapshots created on this driver
	Snapshots map[string]map[string]*storage.Snapshot // map[volumeName]map[snapshotName]snapshot

	// DestroyedSnapshots is here so that tests can check whether delete
	// has been called on a snapshot during or after bootstrapping, since
	// different driver instances with the same config won't actually share
	// state.
	DestroyedSnapshots map[string]bool

	Secret string
	// contains filtered or unexported fields
}

func NewFakeStorageDriver

func NewFakeStorageDriver(ctx context.Context, config drivers.FakeStorageDriverConfig) *StorageDriver

func NewFakeStorageDriverWithDebugTraceFlags

func NewFakeStorageDriverWithDebugTraceFlags(debugTraceFlags map[string]bool) *StorageDriver

func (*StorageDriver) BackendName

func (d *StorageDriver) BackendName() string

BackendName returns the name of the backend managed by this driver instance

func (*StorageDriver) BootstrapSnapshot

func (d *StorageDriver) BootstrapSnapshot(
	ctx context.Context, snapshot *storage.Snapshot, volConfig *storage.VolumeConfig,
)

func (*StorageDriver) BootstrapVolume

func (d *StorageDriver) BootstrapVolume(ctx context.Context, volume *storage.Volume)

func (*StorageDriver) CanSnapshot

CanSnapshot determines whether a snapshot as specified in the provided snapshot config may be taken.

func (StorageDriver) CopyVolumes

func (d StorageDriver) CopyVolumes(volumes map[string]fake.Volume)

CopyVolumes copies Volumes into this instance; there is no "storage system of truth" to use

func (*StorageDriver) Create

func (d *StorageDriver) Create(
	ctx context.Context, volConfig *storage.VolumeConfig, storagePool storage.Pool, volAttributes map[string]sa.Request,
) error

func (*StorageDriver) CreateClone

func (d *StorageDriver) CreateClone(
	ctx context.Context, _, cloneVolConfig *storage.VolumeConfig, _ storage.Pool,
) error

func (*StorageDriver) CreateFollowup

func (d *StorageDriver) CreateFollowup(_ context.Context, volConfig *storage.VolumeConfig) error

func (*StorageDriver) CreatePrepare

func (d *StorageDriver) CreatePrepare(ctx context.Context, volConfig *storage.VolumeConfig)

func (*StorageDriver) CreateSnapshot

func (d *StorageDriver) CreateSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, _ *storage.VolumeConfig,
) (*storage.Snapshot, error)

CreateSnapshot creates a snapshot for the given volume

func (*StorageDriver) DeleteSnapshot

func (d *StorageDriver) DeleteSnapshot(
	_ context.Context, snapConfig *storage.SnapshotConfig, _ *storage.VolumeConfig,
) error

DeleteSnapshot creates a snapshot of a volume.

func (*StorageDriver) Destroy

func (d *StorageDriver) Destroy(ctx context.Context, volConfig *storage.VolumeConfig) error

func (StorageDriver) EnablePublishEnforcement

func (d StorageDriver) EnablePublishEnforcement(ctx context.Context, volume *storage.Volume) error

func (*StorageDriver) Get

func (d *StorageDriver) Get(_ context.Context, name string) error

func (StorageDriver) GetCommonConfig

GetCommonConfig returns driver's CommonConfig

func (*StorageDriver) GetExternalConfig

func (d *StorageDriver) GetExternalConfig(context.Context) interface{}

func (*StorageDriver) GetInternalVolumeName

func (d *StorageDriver) GetInternalVolumeName(_ context.Context, name string) string

func (*StorageDriver) GetProtocol

func (*StorageDriver) GetSnapshot

func (d *StorageDriver) GetSnapshot(
	_ context.Context, snapConfig *storage.SnapshotConfig, _ *storage.VolumeConfig,
) (*storage.Snapshot, error)

GetSnapshot gets a snapshot. To distinguish between an API error reading the snapshot and a non-existent snapshot, this method may return (nil, nil).

func (*StorageDriver) GetSnapshots

func (d *StorageDriver) GetSnapshots(_ context.Context, volConfig *storage.VolumeConfig) (
	[]*storage.Snapshot, error,
)

GetSnapshots returns the list of snapshots associated with the specified volume

func (*StorageDriver) GetStorageBackendPhysicalPoolNames

func (d *StorageDriver) GetStorageBackendPhysicalPoolNames(context.Context) []string

GetStorageBackendPhysicalPoolNames retrieves storage backend physical pools

func (*StorageDriver) GetStorageBackendSpecs

func (d *StorageDriver) GetStorageBackendSpecs(_ context.Context, backend storage.Backend) error

func (*StorageDriver) GetUpdateType

func (d *StorageDriver) GetUpdateType(_ context.Context, driverOrig storage.Driver) *roaring.Bitmap

GetUpdateType returns a bitmap populated with updates to the driver

func (*StorageDriver) GetVolumeExternal

func (d *StorageDriver) GetVolumeExternal(_ context.Context, name string) (*storage.VolumeExternal, error)

func (*StorageDriver) GetVolumeExternalWrappers

func (d *StorageDriver) GetVolumeExternalWrappers(_ context.Context, channel chan *storage.VolumeExternalWrapper)

func (StorageDriver) GoString

func (d StorageDriver) GoString() string

GoString implements GoStringer interface for the FakeStorageDriver driver

func (*StorageDriver) Import

func (d *StorageDriver) Import(ctx context.Context, volConfig *storage.VolumeConfig, originalName string) error

func (*StorageDriver) Initialize

func (d *StorageDriver) Initialize(
	ctx context.Context, _ tridentconfig.DriverContext, configJSON string,
	commonConfig *drivers.CommonStorageDriverConfig, backendSecret map[string]string, _ string,
) error

func (*StorageDriver) Initialized

func (d *StorageDriver) Initialized() bool

func (*StorageDriver) Name

func (d *StorageDriver) Name() string

func (*StorageDriver) Publish

func (*StorageDriver) ReconcileNodeAccess

func (d *StorageDriver) ReconcileNodeAccess(ctx context.Context, nodes []*utils.Node, _ string) error

func (*StorageDriver) Rename

func (d *StorageDriver) Rename(ctx context.Context, name, newName string) error

func (*StorageDriver) Resize

func (d *StorageDriver) Resize(_ context.Context, volConfig *storage.VolumeConfig, sizeBytes uint64) error

Resize expands the volume size.

func (*StorageDriver) RestoreSnapshot

func (d *StorageDriver) RestoreSnapshot(
	_ context.Context, snapConfig *storage.SnapshotConfig, _ *storage.VolumeConfig,
) error

RestoreSnapshot restores a volume (in place) from a snapshot.

func (*StorageDriver) StoreConfig

func (StorageDriver) String

func (d StorageDriver) String() string

String implements Stringer interface for the FakeStorageDriver driver

func (*StorageDriver) Terminate

func (d *StorageDriver) Terminate(context.Context, string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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