facts

package
v0.0.0-...-f1d979d Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIsNotAllowedFactProvider error returned when fact provider is not allowed to modify (write or delete) passport facts.
	ErrIsNotAllowedFactProvider = errors.New("facts: not allowed fact provider")
	// ErrOutOfUint256Range error returned when value is out of uint256 range [0; 2^256-1]
	ErrOutOfUint256Range = errors.New("facts: out of uint256 range")
	// ErrOutOfInt256Range error returned when value is out of int256 range [-2^255; 2^255-1]
	ErrOutOfInt256Range = errors.New("facts: out of int256 range")
)

Functions

This section is empty.

Types

type Change

type Change struct {
	// ChangeType represents type of data change
	ChangeType change.Type
	// DataType represents type of data
	DataType data.Type
	// Address of fact provider
	FactProvider common.Address
	// Key of the value
	Key [32]byte
	// Blockchain specific contextual infos
	Raw types.Log
}

Change contains information about data change

type ChangeIterator

type ChangeIterator struct {
	Change *Change // Change containing the info of the last retrieved change
	// contains filtered or unexported fields
}

ChangeIterator is returned from FilterChanges and is used to iterate over the changes and unpacked data for Updated and Deleted events raised by the PassportLogic contract.

func (*ChangeIterator) Close

func (it *ChangeIterator) Close() error

Close terminates the iteration process, releasing any pending underlying resources.

func (*ChangeIterator) Error

func (it *ChangeIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*ChangeIterator) Next

func (it *ChangeIterator) Next() bool

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

func (*ChangeIterator) ToSlice

func (it *ChangeIterator) ToSlice() (ps []*Change, err error)

ToSlice retrieves all changes and saves them into slice.

type ChangesFilterOpts

type ChangesFilterOpts struct {
	Start        uint64           // Start of the queried range
	End          *uint64          // End of the range (nil = latest)
	ChangeType   []change.Type    // ChangeType is a slice of change types to filter (nil = all change types)
	DataType     []data.Type      // DataType is a slice of data types to filter (nil = all data types)
	FactProvider []common.Address // FactProvider is a slice of fact providers to filter (nil = all fact providers)
	Key          [][32]byte       // Key is a slice of keys to filter (nil = all keys)
	Context      context.Context  // Network context to support cancellation and timeouts (nil = no timeout)
}

ChangesFilterOpts is the collection of options to fine tune filtering for changes.

type Historian

type Historian eth.Eth

Historian reads the fact history

func NewHistorian

func NewHistorian(e *eth.Eth) *Historian

NewHistorian converts eth to Historian

func (*Historian) FilterChanges

func (h *Historian) FilterChanges(opts *ChangesFilterOpts, passportAddress common.Address) (*ChangeIterator, error)

FilterChanges retrieves changes from event log of passport.

func (*Historian) GetHistoryItemOfWriteAddress

func (h *Historian) GetHistoryItemOfWriteAddress(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteAddressHistoryItem, error)

GetHistoryItemOfWriteAddress returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteBool

func (h *Historian) GetHistoryItemOfWriteBool(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteBoolHistoryItem, error)

GetHistoryItemOfWriteBool returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteBytes

func (h *Historian) GetHistoryItemOfWriteBytes(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteBytesHistoryItem, error)

GetHistoryItemOfWriteBytes returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteIPFSHash

func (h *Historian) GetHistoryItemOfWriteIPFSHash(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteIPFSHashHistoryItem, error)

GetHistoryItemOfWriteIPFSHash returns the IPFS hash value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteInt

func (h *Historian) GetHistoryItemOfWriteInt(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteIntHistoryItem, error)

GetHistoryItemOfWriteInt returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteString

func (h *Historian) GetHistoryItemOfWriteString(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteStringHistoryItem, error)

GetHistoryItemOfWriteString returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteTxData

func (h *Historian) GetHistoryItemOfWriteTxData(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteTxDataHistoryItem, error)

GetHistoryItemOfWriteTxData returns the data value that was set in the given transaction.

func (*Historian) GetHistoryItemOfWriteUint

func (h *Historian) GetHistoryItemOfWriteUint(ctx context.Context, passport common.Address, txHash common.Hash) (*WriteUintHistoryItem, error)

GetHistoryItemOfWriteUint returns the data value that was set in the given transaction.

type Provider

type Provider eth.Session

Provider provides the facts

func NewProvider

func NewProvider(s *eth.Session) *Provider

NewProvider converts session to Provider

func (*Provider) DeleteAddress

func (p *Provider) DeleteAddress(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteAddress deletes address data for the specific key

func (*Provider) DeleteBool

func (p *Provider) DeleteBool(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteBool deletes bool data for the specific key

func (*Provider) DeleteBytes

func (p *Provider) DeleteBytes(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteBytes deletes bytes data for the specific key

func (*Provider) DeleteIPFSHash

func (p *Provider) DeleteIPFSHash(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteIPFSHash deletes IPFS hash for the specific key

func (*Provider) DeleteInt

func (p *Provider) DeleteInt(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteInt deletes int data for the specific key

func (*Provider) DeleteString

func (p *Provider) DeleteString(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteString deletes string data for the specific key

func (*Provider) DeleteTxData

func (p *Provider) DeleteTxData(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteTxData deletes tx data for the specific key

func (*Provider) DeleteUint

func (p *Provider) DeleteUint(ctx context.Context, passportAddress common.Address, key [32]byte) (common.Hash, error)

DeleteUint deletes uint data for the specific key

func (*Provider) WriteAddress

func (p *Provider) WriteAddress(ctx context.Context, passportAddress common.Address, key [32]byte, data common.Address) (common.Hash, error)

WriteAddress writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteBool

func (p *Provider) WriteBool(ctx context.Context, passportAddress common.Address, key [32]byte, data bool) (common.Hash, error)

WriteBool writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteBytes

func (p *Provider) WriteBytes(ctx context.Context, passportAddress common.Address, key [32]byte, data []byte) (common.Hash, error)

WriteBytes writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteIPFSHash

func (p *Provider) WriteIPFSHash(ctx context.Context, passportAddress common.Address, key [32]byte, hash string) (common.Hash, error)

WriteIPFSHash writes IPFS hash for specific key (uses Ethereum storage to store the hash)

func (*Provider) WriteInt

func (p *Provider) WriteInt(ctx context.Context, passportAddress common.Address, key [32]byte, data *big.Int) (common.Hash, error)

WriteInt writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteString

func (p *Provider) WriteString(ctx context.Context, passportAddress common.Address, key [32]byte, data string) (common.Hash, error)

WriteString writes data for the specific key (uses Ethereum storage)

func (*Provider) WriteTxData

func (p *Provider) WriteTxData(ctx context.Context, passportAddress common.Address, key [32]byte, data []byte) (common.Hash, error)

WriteTxData writes data for the specific key (uses transaction data)

func (*Provider) WriteUint

func (p *Provider) WriteUint(ctx context.Context, passportAddress common.Address, key [32]byte, data *big.Int) (common.Hash, error)

WriteUint writes data for the specific key (uses Ethereum storage)

type Reader

type Reader eth.Eth

Reader reads the facts

func NewReader

func NewReader(e *eth.Eth) *Reader

NewReader converts eth to Reader

func (*Reader) ReadAddress

func (r *Reader) ReadAddress(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (common.Address, error)

ReadAddress reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadBool

func (r *Reader) ReadBool(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (bool, error)

ReadBool reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadBytes

func (r *Reader) ReadBytes(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) ([]byte, error)

ReadBytes reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadIPFSHash

func (r *Reader) ReadIPFSHash(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (string, error)

ReadIPFSHash reads the IPFS hash from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadInt

func (r *Reader) ReadInt(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (*big.Int, error)

ReadInt reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadString

func (r *Reader) ReadString(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (string, error)

ReadString reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadTxData

func (r *Reader) ReadTxData(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) ([]byte, error)

ReadTxData reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

func (*Reader) ReadUint

func (r *Reader) ReadUint(ctx context.Context, passport common.Address, factProvider common.Address, key [32]byte) (*big.Int, error)

ReadUint reads the data from the specific key of the given data provider. `ethereum.NotFound` error returned in case no value exists for the given key.

type WriteAddressHistoryItem

type WriteAddressHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         common.Address
}

WriteAddressHistoryItem holds parameters of WriteAddress call

type WriteBoolHistoryItem

type WriteBoolHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         bool
}

WriteBoolHistoryItem holds parameters of WriteBool call

type WriteBytesHistoryItem

type WriteBytesHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         []byte
}

WriteBytesHistoryItem holds parameters of WriteBytes call

type WriteIPFSHashHistoryItem

type WriteIPFSHashHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Hash         string
}

WriteIPFSHashHistoryItem holds parameters of WriteIPFSHash call

type WriteIntHistoryItem

type WriteIntHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         *big.Int
}

WriteIntHistoryItem holds parameters of WriteInt call

type WriteStringHistoryItem

type WriteStringHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         string
}

WriteStringHistoryItem holds parameters of WriteString call

type WriteTxDataHistoryItem

type WriteTxDataHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         []byte
}

WriteTxDataHistoryItem holds parameters of WriteTxData call

type WriteUintHistoryItem

type WriteUintHistoryItem struct {
	FactProvider common.Address
	Key          [32]byte
	Data         *big.Int
}

WriteUintHistoryItem holds parameters of WriteUint call

Jump to

Keyboard shortcuts

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