upload

package
v2.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchIDForChunk

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

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

func CleanupDirty

func CleanupDirty(st transaction.Storage) error

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

func DeleteTag

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

DeleteTag deletes TagItem associated with the given tagID.

func IterateAll

func IterateAll(st storage.Reader, iterateFn func(item storage.Item) (bool, error)) error

func IterateAllTagItems

func IterateAllTagItems(st storage.Reader, cb func(ti *TagItem) (bool, error)) error

func IteratePending added in v2.1.0

func IteratePending(ctx context.Context, s transaction.ReadOnlyStore, consumerFn func(chunk swarm.Chunk) (bool, error)) error

func NewPutter

NewPutter returns a new chunk putter associated with the tagID. Calls to the Putter must be mutex locked to prevent concurrent upload data races.

func Report

func Report(ctx context.Context, st transaction.Store, chunk swarm.Chunk, state storage.ChunkState) error

Report is the implementation of the PushReporter interface.

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.Reader) ([]TagItem, error)

ListAllTags returns all the TagItems in the store.

func NextTag

func NextTag(st storage.IndexStore) (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.Reader, 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