hashstore

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMMapcfg = hashstore.MmapCfg{}

Functions

func ReadFull

func ReadFull(path string, data []byte) ([]byte, error)

Types

type Audit added in v1.9.0

type Audit struct {
	Prefix    string
	Hashstore string `help:"the location of the hashstore files" default:"."`
}

func (*Audit) Run added in v1.9.0

func (a *Audit) Run() error

type Compact

type Compact struct {
	WithHashstore
	AliveFraction          float64 `help:"Fraction of alive data to keep" default:"0.25"`
	DeleteTrashImmediately bool    `help:"Delete trash segments immediately" default:"true"`
	RewriteMultiple        float64 `help:"Limit data size to be rewritten in one cycle" default:"2.0"`
}

func (*Compact) Run

func (i *Compact) Run() error

type Convert

type Convert struct {
	Dir         string
	Destination string
	SatelliteID storj.NodeID
}

func (*Convert) Copy

func (i *Convert) Copy(ctx context.Context, store blobstore.Blobs, op *piecestore.HashStoreBackend, info blobstore.BlobInfo, buf []byte, header *pb.PieceHeader) (err error)

func (*Convert) Run

func (i *Convert) Run() error

type Diff added in v1.4.0

type Diff struct {
	Left  string `arg:"" help:"left hashstore"`
	Right string `arg:"" help:"right hashstore"`
}

func (Diff) Run added in v1.4.0

func (d Diff) Run() error

type Generate added in v1.1.0

type Generate struct {
	load.PieceIDStream
	Dir          string        `help:"directory of the store (not the db!)" default:"/tmp/store"`
	Samples      int           `help:"number of pieces to be written" default:"1"`
	Size         int64         `help:"size of the pieces to be written" default:"100000"`
	TTL          time.Duration `help:"TTL to be used"`
	TTLModulo    int           `help:"modulo for TTL. Only the selected pieces with this modulo will be TTLed" default:"1"`
	MinTableSize uint64        `help:"minimum table size for the store" default:"20"`
	MetaPath     string        `help:"path to the meta file" default:""`
}

func (Generate) Run added in v1.1.0

func (b Generate) Run() error

type Get added in v1.4.0

type Get struct {
	WithHashtable
	ID string `arg:"" help:"the id of the record to get"`
}

func (*Get) Run added in v1.4.0

func (i *Get) Run() error

type Hashstore

type Hashstore struct {
	Convert Convert `cmd:"" help:"import data to the hashtable"`
	List    List    `cmd:"" help:"list content of a hashtable"`
	Stat    Stat    `cmd:"" help:"list content of a hashtable stat"`
	//Generate Generate `cmd:"" help:"generate data to a hashtable store"`
	Compact     Compact     `cmd:"" help:"compact a hashtable store"`
	Report      Report      `cmd:"" help:"show additional reports on a hashtable store"`
	Logs        Logs        `cmd:"" help:"show current log file load"`
	TTLReport   TTLReport   `cmd:"" help:"print out ttl expiration per file"`
	Recover     Recover     `cmd:"" help:"recover hashtable (metadata) from a hashstore log files"`
	RestoreTime RestoreTime `cmd:"" help:"get/set restore time for a satellite"`
	Get         Get         `cmd:"" help:"get a record from a hashtable"`
	Diff        Diff        `cmd:"" help:"diff two hashstore"`
	Audit       Audit       `cmd:"" help:"audit a hashstore: check if pieces are included"`
	LogRead     LogRead     `cmd:"" help:"find record in hashstore log files without using metadata"`
}

type HashstoreReport added in v1.7.0

type HashstoreReport struct {
	Table string
	Stat  PieceStat
	Sum   struct {
		NonTTL PieceStat
		TTL    PieceStat
		Trash  PieceStat
	}
	Trash []HistogramItem
	TTL   []HistogramItem
}

type HistogramItem added in v1.7.0

type HistogramItem struct {
	Day   int
	Count int
	Size  int
}

type List

type List struct {
	WithHashtable
	Expired bool   `help:"list expired records" default:"true"`
	Trash   bool   `help:"list trashed records" default:"true"`
	ValidAt string `help:"list records only if valid at this time (created before, expired after)"`
	Key     bool   `help:"print only keys in PieceID format"`
}

func (*List) Run

func (i *List) Run() error

type LogRead added in v1.9.0

type LogRead struct {
	Dir   string `default:"." help:"the directory to recover"`
	Piece string `arg:"" help:"the piece to read from the logs"`
}

func (*LogRead) RecoverOne added in v1.9.0

func (n *LogRead) RecoverOne(path string, process func(hashstore.Record) error) error

func (*LogRead) Run added in v1.9.0

func (n *LogRead) Run() (err error)

type LogReport added in v1.5.0

type LogReport struct {
	ID              int
	Path            string
	RealSize        memory.Size
	Used            memory.Size
	Expired         memory.Size
	Trash           memory.Size
	TTL             time.Time
	LastUsefullByte memory.Size
}

func (LogReport) Unknown added in v1.5.0

func (r LogReport) Unknown() memory.Size

type Logs added in v1.3.0

type Logs struct {
	WithHashstore
	AliveFraction    float64 `help:"the fraction of live data in a log file to consider it for compaction" default:"0.25"`
	ProbabilityPower float64 `help:"the power to raise the compaction probability to" default:"2.0"`
}

func (*Logs) Run added in v1.3.0

func (l *Logs) Run() error

type PieceStat added in v1.7.0

type PieceStat struct {
	Count int
	Size  int
}

type Recover added in v1.3.0

type Recover struct {
	Dir     string `default:"." help:"the directory to recover"`
	MetaDir string `help:"the directory to create the recovered hashtable"`
	Size    int    `default:"26" help:"size of the new hashtable (power of 2)"`
	Kind    int    `default:"1" help:"kind of the hashtable, 0 hashtbl, 1 memtbl"`
}

func (*Recover) RecoverOne added in v1.3.0

func (n *Recover) RecoverOne(path string, process func(hashstore.Record) error) error

func (*Recover) Run added in v1.3.0

func (n *Recover) Run() (err error)

type Report added in v1.1.0

type Report struct {
	WithHashtable
	JSON bool `help:"Output in JSON format"`
}

func (*Report) Run added in v1.1.0

func (i *Report) Run() error

type RestoreTime added in v1.3.0

type RestoreTime struct {
	NewValue    time.Time    `cmd:"arg"`
	Dir         string       `default:"" help:"the directory to recover"`
	SatelliteID storj.NodeID `default:"12EayRS2V1kEsWESU9QMRseFhdxYxKicsiFmxrsLZHeLUtdps3S"`
}

func (*RestoreTime) Run added in v1.3.0

func (r *RestoreTime) Run() error

type Stat added in v1.1.0

type Stat struct {
	WithHashtable
}

func (*Stat) Run added in v1.1.0

func (i *Stat) Run() error

type TTLReport added in v1.3.0

type TTLReport struct {
	WithHashtable
}

func (*TTLReport) Run added in v1.3.0

func (l *TTLReport) Run() error

type TimeHistogram added in v1.4.0

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

func NewTimeHistogram added in v1.4.0

func NewTimeHistogram() *TimeHistogram

func (*TimeHistogram) Count added in v1.4.0

func (t *TimeHistogram) Count() (res int)

func (*TimeHistogram) Increment added in v1.4.0

func (t *TimeHistogram) Increment(idx int, size int)

func (*TimeHistogram) Print added in v1.4.0

func (t *TimeHistogram) Print(minLimit int, maxLimit int)

type WithHashstore added in v1.12.0

type WithHashstore struct {
	LogDir  string `help:"directory of the store" `
	MetaDir string `help:"directory of the hashtable files"`
	Path    string `arg:"" help:"the path to the hashtable file (or directory with one hashtbl file)" optional:"true"`
	Logs    string `arg:""  optional:"true"`
}

func (WithHashstore) GetPath added in v1.12.0

func (w WithHashstore) GetPath() (string, string)

GetPath returns the meta path and log path based on the WithHashstore configuration.

type WithHashtable added in v1.5.0

type WithHashtable struct {
	Path string `arg:"" help:"the path to the hashtable file (or directory with one hashtbl file)"`
}

func (WithHashtable) Open added in v1.5.0

func (w WithHashtable) Open(ctx context.Context) (hashstore.Tbl, func() error, error)

Jump to

Keyboard shortcuts

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