ownership

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

this 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(issueTxId merkle.Digest, issueBlockNumber uint64, assetId transactionrecord.AssetIdentifier, newOwner *account.Account)

func CreateBlock

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

func CurrentlyOwns

func CurrentlyOwns(owner *account.Account, txId merkle.Digest) bool

check owner currently owns this transaction id

func OwnerOf

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

find the owner of a specific transaction

func Share added in v0.10.0

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

need to have a lock

func Transfer

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

Types

type AssetOwnerData added in v0.10.0

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

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 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
}

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 block owner data to byte slice

func (BlockOwnerData) TransferBlockNumber added in v0.10.0

func (b BlockOwnerData) TransferBlockNumber() uint64

type OwnedItem

type OwnedItem byte

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)

convert item to text

func (OwnedItem) String

func (item OwnedItem) 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

convert test to Item

type OwnerData added in v0.10.0

type OwnerData interface {
	Pack() PackedOwnerData

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

func GetOwnerData added in v0.10.0

func GetOwnerData(txId merkle.Digest) (OwnerData, error)

fetch and unpack owner data

func GetOwnerDataB added in v0.10.0

func GetOwnerDataB(txId []byte) (OwnerData, error)

fetch and unpack owner data

type Ownership

type Ownership 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"`
}

type to represent an ownership record

func ListBitmarksFor

func ListBitmarksFor(owner *account.Account, start uint64, count int) ([]Ownership, error)

fetch a list of bitmarks for an owner

type PackedOwnerData added in v0.10.0

type PackedOwnerData []byte

func (PackedOwnerData) Unpack added in v0.10.0

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

unpack record into the appropriate type

type ShareOwnerData added in v0.10.0

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

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