upload

package
v0.0.0-...-eb12069 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchIDForChunk

func BatchIDForChunk(st storage.Store, addr swarm.Address) ([]byte, error)

BatchIDForChunk returns the first known batchID for the given chunk address.

func CleanupDirty

func CleanupDirty(batch internal.BatchOperation) error

CleanupDirty does a best-effort cleanup of dirty tags. This is called on startup.

func DeleteTag

func DeleteTag(st storage.Store, tagID uint64) error

DeleteTag deletes TagItem associated with the given tagID.

func Iterate

func Iterate(ctx context.Context, s internal.Storage, consumerFn func(chunk swarm.Chunk) (bool, error)) error

func IterateAll

func IterateAll(st storage.Store, iterateFn func(addr swarm.Address, isSynced bool) (bool, error)) error

func NewPushReporter

func NewPushReporter(s internal.Storage) storage.PushReporter

NewPushReporter returns a new storage.PushReporter which can be used by the pusher component to report chunk state information.

func NewPutter

NewPutter returns a new chunk putter associated with the tagID.

Types

type TagItem

type TagItem struct {
	TagID     uint64        // unique identifier for the tag
	Split     uint64        // total no of chunks processed by the splitter for hashing
	Seen      uint64        // total no of chunks already seen
	Stored    uint64        // total no of chunks stored locally on the node
	Sent      uint64        // total no of chunks sent to the neighbourhood
	Synced    uint64        // total no of chunks synced with proof
	Address   swarm.Address // swarm.Address associated with this tag
	StartedAt int64         // start timestamp
}

TagItem is an store.Item that stores information about a session of upload.

func ListAllTags

func ListAllTags(st storage.Store) ([]TagItem, error)

ListAllTags returns all the TagItems in the store.

func NextTag

func NextTag(st storage.Store) (TagItem, error)

NextTag returns the next tag ID to be used. It reads the last used ID and increments it by 1. This method needs to be called under lock by user as there is no guarantee for parallel updates.

func TagInfo

func TagInfo(st storage.Store, tagID uint64) (TagItem, error)

TagInfo returns the TagItem for this particular tagID.

func (*TagItem) Clone

func (i *TagItem) Clone() storage.Item

Clone implements the storage.Item interface.

func (TagItem) ID

func (i TagItem) ID() string

ID implements the storage.Item interface.

func (TagItem) Marshal

func (i TagItem) Marshal() ([]byte, error)

Marshal implements the storage.Item interface.

func (TagItem) Namespace

func (i TagItem) Namespace() string

Namespace implements the storage.Item interface.

func (TagItem) String

func (i TagItem) String() string

String implements the fmt.Stringer interface.

func (*TagItem) Unmarshal

func (i *TagItem) Unmarshal(bytes []byte) error

Unmarshal implements the storage.Item interface. If the buffer is not of size tagItemSize, an error is returned.

Jump to

Keyboard shortcuts

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