volume

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VolumeFileMode = os.FileMode(0700)
)

Variables

This section is empty.

Functions

func CreateStorageNodePaths

func CreateStorageNodePaths(volumes []string, cid types.ClusterID, snid types.StorageNodeID) (snPaths []string, err error)

CreateStorageNodePaths creates the directory structure for the storage node data. The directory structure is composed of the volume, cluster ID and storage node ID, for example, "/volume/cid_1_snid_1/".

func LogStreamDirName

func LogStreamDirName(tpid types.TopicID, lsid types.LogStreamID) string

LogStreamDirName returns the directory name of the log stream data. The directory name is composed of the topic ID and log stream ID, for example, "tpid_1_lsid_1".

func StorageNodeDirName

func StorageNodeDirName(cid types.ClusterID, snid types.StorageNodeID) string

StorageNodeDirName returns the directory name of the storage node data. The directory name is composed of the cluster ID and storage node ID, for example, "cid_1_snid_1".

func WritableDirectory

func WritableDirectory(dir string) error

WritableDirectory decides that the argument dir is writable directory.

Types

type DataDir

type DataDir struct {
	// Volume should be an absolute directory.
	Volume        string
	ClusterID     types.ClusterID
	StorageNodeID types.StorageNodeID
	TopicID       types.TopicID
	LogStreamID   types.LogStreamID
}

DataDir represents data directory by using various identifiers.

func GetValidDataDirectories

func GetValidDataDirectories(read []DataDir, given []string, strict bool, cid types.ClusterID, snid types.StorageNodeID) ([]DataDir, error)

GetValidDataDirectories checks data directories read from volumes whether they are valid to load. The argument given, specified by the flag `--data-dirs`, represents required directories that should exist in the directories read from the volumes. If the argument strict is true, which is set by the flag `--volume-strict-check`, no other directories must not exist in the volumes except the directories specified by the argument given. In non-strict mode, on the other hand, those other directories are ignored.

func ParseDataDir

func ParseDataDir(dataDir string) (dd DataDir, err error)

ParseDataDir parses data directory into DataDir struct only by lexical processing. The argument dataDir should be absolute path.

func ReadVolumes

func ReadVolumes(vols []string) ([]DataDir, error)

ReadVolumes reads all data directories from the volumes regardless their validness. It ignores files while walking the volumes. If duplicated volumes are given, this method returns an error. If there are malformed sub-directories in the volumes, it returns an error. To validate each data directories, user should call DataDir.Validate() method.

func (*DataDir) String

func (dd *DataDir) String() string

String returns a full path of data directory. This method is opposite of function ParseDataDir.

func (*DataDir) Valid

func (dd *DataDir) Valid(cid types.ClusterID, snid types.StorageNodeID) error

Valid if the cluster ID and storage node ID are correct and the data directory is writable.

Jump to

Keyboard shortcuts

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