ownership

package
v0.14.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

Package ownership - handles low-level access to the ownership data in storage pool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAsset

func CreateAsset(
	trx storage.Transaction,
	issueTxId merkle.Digest,
	issueBlockNumber uint64,
	assetId transactionrecord.AssetIdentifier,
	newOwner *account.Account,
)

CreateAsset - create the ownership record for an asset

func CreateBlock

func CreateBlock(
	trx storage.Transaction,
	issueTxId merkle.Digest,
	blockNumber uint64,
	newOwner *account.Account,
)

CreateBlock - create the ownership record for a block

func CurrentlyOwns

func CurrentlyOwns(
	trx storage.Transaction,
	owner *account.Account,
	txId merkle.Digest,
	pool storage.Handle,
) bool

CurrentlyOwns - check owner currently owns this transaction id

func Initialise added in v0.13.0

func Initialise(ownerList, ownerData storage.Handle)

Initialise - initialise ownership

func OwnerOf

func OwnerOf(trx storage.Transaction, txId merkle.Digest) (uint64, *account.Account)

OwnerOf - find the owner of a specific transaction

func Share added in v0.10.0

func Share(
	trx storage.Transaction,
	previousTxId merkle.Digest,
	transferTxId merkle.Digest,
	transferBlockNumber uint64,
	currentOwner *account.Account,
	balance uint64,
)

Share - setup for share ownership transfer, must have a lock

func Transfer

func Transfer(
	trx storage.Transaction,
	previousTxId merkle.Digest,
	transferTxId merkle.Digest,
	transferBlockNumber uint64,
	currentOwner *account.Account,
	newOwner *account.Account,
)

Transfer - transfer ownership

Types

type AssetOwnerData added in v0.10.0

type AssetOwnerData struct {
	// contains filtered or unexported fields
}

AssetOwnerData - owner data

func (AssetOwnerData) IssueBlockNumber added in v0.10.0

func (a AssetOwnerData) IssueBlockNumber() uint64

func (AssetOwnerData) IssueTxId added in v0.10.0

func (a AssetOwnerData) IssueTxId() merkle.Digest

accessors

func (AssetOwnerData) Pack added in v0.10.0

Pack - pack asset owner data to byte slice

func (AssetOwnerData) TransferBlockNumber added in v0.10.0

func (a AssetOwnerData) TransferBlockNumber() uint64

type BlockOwnerData added in v0.10.0

type BlockOwnerData struct {
	// contains filtered or unexported fields
}

BlockOwnerData - owner data

func (BlockOwnerData) IssueBlockNumber added in v0.10.0

func (b BlockOwnerData) IssueBlockNumber() uint64

func (BlockOwnerData) IssueTxId added in v0.10.0

func (b BlockOwnerData) IssueTxId() merkle.Digest

accessors

func (BlockOwnerData) Pack added in v0.10.0

Pack - pack block owner data to byte slice

func (BlockOwnerData) TransferBlockNumber added in v0.10.0

func (b BlockOwnerData) TransferBlockNumber() uint64

type OwnedItem

type OwnedItem byte

OwnedItem - the flag byte

const (
	OwnedAsset OwnedItem = iota
	OwnedBlock OwnedItem = iota
	OwnedShare OwnedItem = iota
)

type codes for flag byte

func (OwnedItem) MarshalText

func (item OwnedItem) MarshalText() ([]byte, error)

MarshalText - convert item to text

func (OwnedItem) String

func (item OwnedItem) String() string

String - convert a owned item to its string symbol

func (*OwnedItem) UnmarshalText added in v0.10.0

func (item *OwnedItem) UnmarshalText(s []byte) error

UnmarshalText - convert test to Item

type OwnerData added in v0.10.0

type OwnerData interface {
	Pack() PackedOwnerData

	IssueTxId() merkle.Digest
	TransferBlockNumber() uint64
	IssueBlockNumber() uint64
}

OwnerData - generic owner data methods

func GetOwnerData added in v0.10.0

func GetOwnerData(trx storage.Transaction, txId merkle.Digest, ownerDataHandle storage.Handle) (OwnerData, error)

GetOwnerData - fetch and unpack owner data

func GetOwnerDataB added in v0.10.0

func GetOwnerDataB(trx storage.Transaction, txId []byte, ownerDataHandle storage.Handle) (OwnerData, error)

GetOwnerDataB - fetch and unpack owner data

type Ownership

type Ownership interface {
	ListBitmarksFor(*account.Account, uint64, int) ([]Record, error)
}

Ownership - interface for ownership

func Get added in v0.13.0

func Get() Ownership

Get - return Record interface

type PackedOwnerData added in v0.10.0

type PackedOwnerData []byte

PackedOwnerData - packed data to store in database

func (PackedOwnerData) Unpack added in v0.10.0

func (packed PackedOwnerData) Unpack() (OwnerData, error)

Unpack - unpack record into the appropriate type

type Record added in v0.13.0

type Record struct {
	N           uint64                             `json:"n,string"`
	TxId        merkle.Digest                      `json:"txId"`
	IssueTxId   merkle.Digest                      `json:"issue"`
	Item        OwnedItem                          `json:"item"`
	AssetId     *transactionrecord.AssetIdentifier `json:"assetId,omitempty"`
	BlockNumber *uint64                            `json:"blockNumber,omitempty"`
}

Record - type to represent an ownership record

type ShareOwnerData added in v0.10.0

type ShareOwnerData struct {
	// contains filtered or unexported fields
}

ShareOwnerData - owner data

func (ShareOwnerData) IssueBlockNumber added in v0.10.0

func (a ShareOwnerData) IssueBlockNumber() uint64

func (ShareOwnerData) IssueTxId added in v0.10.0

func (a ShareOwnerData) IssueTxId() merkle.Digest

accessors

func (ShareOwnerData) Pack added in v0.10.0

Pack - pack share owner data to byte slice

func (ShareOwnerData) TransferBlockNumber added in v0.10.0

func (a ShareOwnerData) TransferBlockNumber() uint64

Jump to

Keyboard shortcuts

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