stampindex

package
v2.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(s storage.Writer, namespace string, chunk swarm.Chunk) error

Delete removes the related stamp index record from the storage.

func Store

func Store(s storage.IndexStore, namespace string, chunk swarm.Chunk) error

Store creates new or updated an existing stamp index record related to the given namespace and chunk.

Types

type Item

type Item struct {

	// Values.
	StampTimestamp   []byte
	ChunkAddress     swarm.Address
	ChunkIsImmutable bool
	// contains filtered or unexported fields
}

Item is an store.Item that represents data relevant to stamp.

func Load

func Load(s storage.Reader, namespace string, chunk swarm.Chunk) (*Item, error)

Load returns stamp index record related to the given namespace and chunk. The storage.ErrNotFound is returned if no record is found.

func LoadOrStore

func LoadOrStore(
	s storage.IndexStore,
	namespace string,
	chunk swarm.Chunk,
) (item *Item, loaded bool, err error)

LoadOrStore tries to first load a stamp index related record from the store. If the record is not found, it will try to create and save a new record and return it.

func (*Item) Clone

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

Clone implements the storage.Item interface.

func (Item) ID

func (i Item) ID() string

ID implements the storage.Item interface.

func (Item) Marshal

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

Marshal implements the storage.Item interface.

func (Item) Namespace

func (i Item) Namespace() string

Namespace implements the storage.Item interface.

func (Item) String

func (i Item) String() string

String implements the fmt.Stringer interface.

func (*Item) Unmarshal

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

Unmarshal implements the storage.Item interface.

Jump to

Keyboard shortcuts

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