state

package
v0.0.0-...-4273fad Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Copyright 2019 The trust-net Authors Resource for world state

Copyright 2019 The trust-net Authors World State interface to manage resources for an APP using DLT stack

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWorldState

func NewWorldState(dbp db.DbProvider, shardId []byte) (*worldState, error)

Types

type Resource

type Resource struct {
	// key identifier for the resource (typically a UUID)
	Key []byte
	// identity of the owner of this resource
	Owner []byte
	// opaque serialized value of the resource
	Value []byte
}

A resource in the world state of a shard

func (*Resource) DeSerialize

func (r *Resource) DeSerialize(data []byte) error

func (*Resource) Serialize

func (r *Resource) Serialize() ([]byte, error)

type State

type State interface {
	// used to check if a transaction is already seen by the shard, so as to skip duplicates
	// also, marks the transaction as seen for any future reference
	Seen(txId []byte) bool
	Get(key []byte) (*Resource, error)
	Put(r *Resource) error
	Delete(key []byte) error
	Persist() error
	Reset() error
	Close() error
}

Jump to

Keyboard shortcuts

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