shelf

package
v0.0.0-...-521a54a Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHELF_DIR = ".miner"
)

Variables

This section is empty.

Functions

func ObjectDir

func ObjectDir(group, prefixBytes string) (string, error)

ObjectDir returns the directory path to store all object type of records - type 1: marks

  • Record of each mine execution, in the format of TIMESTAMP PARENT MARK HASH ACCORDING MAP HASH 1 ACCORDING MAP HASH 2 ...

- type 2: maps

  • A list of stuff records, each module will have it own stuff record, in the format of ACCORDING STUFF HASH 1 <SPACE> STUFF IDENTIFIER ACCORDING STUFF HASH 2 <SPACE> STUFF IDENTIFIER ...

- type 3: stuff

  • Record of fetched stuff information, in json format of struct shared.MinerResource

func ObjectFile

func ObjectFile(group, objectHash string) (string, error)

ObjectFile returns the file path to store the object record with the given file name

func RefFile

func RefFile(group, name string) (string, error)

RefFile returns the file path to store the reference to the latest record mark with the given file name

Types

type IdentifierHashMap

type IdentifierHashMap struct {
	Identifier string
	Hash       string
}

type IdentifierHashMaps

type IdentifierHashMaps struct {
	Hash string
	// Module   string
	Group string
	Maps  []IdentifierHashMap
	// contains filtered or unexported fields
}

func (*IdentifierHashMaps) Sort

func (ihm *IdentifierHashMaps) Sort()

Sort sorts the IdentifierHashMaps by the hash field.

func (*IdentifierHashMaps) Write

func (lhm *IdentifierHashMaps) Write() error

type LabelMark

type LabelMark struct {
	// Module       string
	Hash      string
	TimeStamp time.Time
	Parent    string
	Mappings  []MarkMapping
	Group     string
	// contains filtered or unexported fields
}

func NewMark

func NewMark(plugName, plugId string, mapHash string) (*LabelMark, error)

NewMark creates a new label mark with the given plugin name, plugin id and label map hash.

func (*LabelMark) AddMapping

func (lm *LabelMark) AddMapping(module, hash string)

AddMapping adds a new mark mapping to the label mark.

func (*LabelMark) Update

func (lm *LabelMark) Update() error

Update writes the label mark to a file in format: timestamp parent label map hash

And also updates the HEAD reference to the hash of the latest label mark.

type MarkMapping

type MarkMapping struct {
	Module string
	Hash   string
}

type Stuff

type Stuff struct {
	Hash string
	// Module   string
	Identity string
	Resource []byte
}

func NewStuff

func NewStuff(plugId string, resource shared.MinerResource) (*Stuff, error)

NewStuff creates a new Stuff from a plugin name and a MinerResource

func (*Stuff) ResourceIdentifier

func (s *Stuff) ResourceIdentifier() (string, error)

ResourceIdentifier extract and return Identifier value from stored resource

func (*Stuff) Write

func (s *Stuff) Write() error

Write writes the Stuff resource content to a file

Jump to

Keyboard shortcuts

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