stampindex

package
v2.2.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Sep 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 DeleteWithStamp

func DeleteWithStamp(s storage.Writer, namespace string, stamp swarm.Stamp) error

DeleteWithStamp 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 {
	BatchID    []byte
	StampIndex []byte
	StampHash  []byte

	// Values.
	StampTimestamp []byte
	ChunkAddress   swarm.Address
	// 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 LoadWithStamp

func LoadWithStamp(s storage.Reader, namespace string, stamp swarm.Stamp) (*Item, error)

LoadWithStamp returns stamp index record related to the given namespace and stamp.

func (*Item) Clone

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

Clone implements the storage.Item interface.

func (Item) GetNamespace

func (i Item) GetNamespace() []byte

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) SetNamespace

func (i *Item) SetNamespace(ns []byte)

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.

type ItemV1 added in v2.2.0

type ItemV1 struct {
	BatchID    []byte
	StampIndex []byte

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

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

func (*ItemV1) Clone added in v2.2.0

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

Clone implements the storage.Item interface.

func (ItemV1) ID added in v2.2.0

func (i ItemV1) ID() string

ID implements the storage.Item interface.

func (ItemV1) Marshal added in v2.2.0

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

Marshal implements the storage.Item interface.

func (ItemV1) Namespace added in v2.2.0

func (i ItemV1) Namespace() string

Namespace implements the storage.Item interface.

func (*ItemV1) SetNamespace added in v2.2.0

func (i *ItemV1) SetNamespace(ns []byte)

func (ItemV1) String added in v2.2.0

func (i ItemV1) String() string

String implements the fmt.Stringer interface.

func (*ItemV1) Unmarshal added in v2.2.0

func (i *ItemV1) 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