lazyfilewalker

package
v1.109.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UsedSpaceFilewalkerCmdName is the name of the used-space-filewalker subcommand.
	UsedSpaceFilewalkerCmdName = "used-space-filewalker"
	// GCFilewalkerCmdName is the name of the gc-filewalker subcommand.
	GCFilewalkerCmdName = "gc-filewalker"
	// TrashCleanupFilewalkerCmdName is the name of the trash-cleanup-filewalker subcommand.
	TrashCleanupFilewalkerCmdName = "trash-cleanup-filewalker"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TODO: just trying to match the names in storagenodedb.Config. Change these to be more descriptive.
	Storage   string `help:"path to the storage database directory"`
	Info      string `help:"path to the piecestore db"`
	Info2     string `help:"path to the info database"`
	Driver    string `help:"database driver to use" default:"sqlite3"`
	Pieces    string `help:"path to store pieces in"`
	Cache     string `` /* 131-byte string literal not displayed */
	Filestore filestore.Config

	LowerIOPriority bool `help:"if true, the process will run with lower IO priority" default:"true"`
}

Config is the config for lazyfilewalker process.

func (*Config) Args

func (config *Config) Args() []string

Args returns the flags to be passed lazyfilewalker process.

type GCFilewalkerRequest added in v1.79.1

type GCFilewalkerRequest struct {
	SatelliteID   storj.NodeID `json:"satelliteID"`
	BloomFilter   []byte       `json:"bloomFilter"`
	CreatedBefore time.Time    `json:"createdBefore"`
}

GCFilewalkerRequest is the request struct for the gc-filewalker process.

type GCFilewalkerResponse added in v1.79.1

type GCFilewalkerResponse struct {
	PieceIDs           []storj.PieceID `json:"pieceIDs"`
	PiecesSkippedCount int64           `json:"piecesSkippedCount"`
	PiecesCount        int64           `json:"piecesCount"`
	Completed          bool            `json:"completed"`
}

GCFilewalkerResponse is the response struct for the gc-filewalker process.

type Supervisor

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

Supervisor manages the lazyfilewalker subprocesses.

TODO: we should keep track of the number of subprocesses we have running and limit it to a configurable number, and queue them, since they are run per satellite.

func NewSupervisor

func NewSupervisor(log *zap.Logger, config Config, executable string) *Supervisor

NewSupervisor creates a new lazy filewalker Supervisor.

func (*Supervisor) TestingSetGCCmd added in v1.79.1

func (fw *Supervisor) TestingSetGCCmd(cmd execwrapper.Command)

TestingSetGCCmd sets the command for the gc-filewalker subprocess. The cmd acts as a replacement for the subprocess.

func (*Supervisor) TestingSetTrashCleanupCmd added in v1.100.2

func (fw *Supervisor) TestingSetTrashCleanupCmd(cmd execwrapper.Command)

TestingSetTrashCleanupCmd sets the command for the trash cleanup filewalker subprocess. The cmd acts as a replacement for the subprocess.

func (*Supervisor) TestingSetUsedSpaceCmd added in v1.79.1

func (fw *Supervisor) TestingSetUsedSpaceCmd(cmd execwrapper.Command)

TestingSetUsedSpaceCmd sets the command for the used-space-filewalker subprocess. The cmd acts as a replacement for the subprocess.

func (*Supervisor) WalkAndComputeSpaceUsedBySatellite

func (fw *Supervisor) WalkAndComputeSpaceUsedBySatellite(ctx context.Context, satelliteID storj.NodeID) (piecesTotal int64, piecesContentSize int64, err error)

WalkAndComputeSpaceUsedBySatellite returns the total used space by satellite.

func (*Supervisor) WalkCleanupTrash added in v1.100.2

func (fw *Supervisor) WalkCleanupTrash(ctx context.Context, satelliteID storj.NodeID, dateBefore time.Time) (bytesDeleted int64, keysDeleted []storj.PieceID, err error)

WalkCleanupTrash deletes per-day trash directories which are older than the given time. The lazyfilewalker does not update the space used by the trash so the caller should update the space used after the filewalker completes.

func (*Supervisor) WalkSatellitePiecesToTrash added in v1.79.1

func (fw *Supervisor) WalkSatellitePiecesToTrash(ctx context.Context, satelliteID storj.NodeID, createdBefore time.Time, filter *bloomfilter.Filter, trashFunc func(pieceID storj.PieceID) error) (pieceIDs []storj.PieceID, piecesCount, piecesSkipped int64, err error)

WalkSatellitePiecesToTrash walks the satellite pieces and moves the pieces that are trash to the trash using the trashFunc provided.

type TrashCleanupRequest added in v1.100.2

type TrashCleanupRequest struct {
	SatelliteID storj.NodeID `json:"satelliteID"`
	DateBefore  time.Time    `json:"dateBefore"`
}

TrashCleanupRequest is the request struct for the trash-cleanup-filewalker process.

type TrashCleanupResponse added in v1.100.2

type TrashCleanupResponse struct {
	BytesDeleted int64           `json:"bytesDeleted"`
	KeysDeleted  []storj.PieceID `json:"keysDeleted"`
}

TrashCleanupResponse is the response struct for the trash-cleanup-filewalker process.

type TrashHandler added in v1.109.1

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

TrashHandler is a writer that processes the output of the gc-filewalker subprocess.

func NewTrashHandler added in v1.109.1

func NewTrashHandler(log *zap.Logger, trashFunc func(pieceID storj.PieceID) error) *TrashHandler

NewTrashHandler creates new trash handler.

func (*TrashHandler) Decode added in v1.109.1

func (t *TrashHandler) Decode(v interface{}) error

Decode decodes the data from the buffer into the provided value.

func (*TrashHandler) Write added in v1.109.1

func (t *TrashHandler) Write(b []byte) (n int, err error)

Write writes the provided bytes to the buffer.

type UsedSpaceRequest

type UsedSpaceRequest struct {
	SatelliteID storj.NodeID `json:"satelliteID"`
}

UsedSpaceRequest is the request struct for the used-space-filewalker process.

type UsedSpaceResponse

type UsedSpaceResponse struct {
	PiecesTotal       int64 `json:"piecesTotal"`
	PiecesContentSize int64 `json:"piecesContentSize"`
}

UsedSpaceResponse is the response struct for the used-space-filewalker process.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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