stampindex

package
v2.3.0-rc10 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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, scope string, stamp swarm.Stamp) error

Delete removes the related stamp index record from the storage.

func Store

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

Store creates new or updated an existing stamp index record related to the given scope 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, scope string, stamp swarm.Stamp) (*Item, error)

Load returns stamp index record related to the given scope and stamp.

func LoadOrStore

func LoadOrStore(
	s storage.IndexStore,
	scope 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) GetScope added in v2.2.0

func (i Item) GetScope() []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) SetScope added in v2.2.0

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