ownership

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: ISC Imports: 10 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	FlagByteStart  = 0
	FlagByteFinish = FlagByteStart + oneByteSize

	TxIdStart  = FlagByteFinish
	TxIdFinish = TxIdStart + merkle.DigestLength

	TransferBlockNumberStart  = TxIdFinish
	TransferBlockNumberFinish = TransferBlockNumberStart + uint64ByteSize

	IssueTxIdStart  = TransferBlockNumberFinish
	IssueTxIdFinish = IssueTxIdStart + merkle.DigestLength

	IssueBlockNumberStart  = IssueTxIdFinish
	IssueBlockNumberFinish = IssueBlockNumberStart + uint64ByteSize

	// overlap flag==0x00
	AssetIdentifierStart  = IssueBlockNumberFinish
	AssetIdentifierFinish = AssetIdentifierStart + transactionrecord.AssetIdentifierLength

	// overlap flag==0x01
	OwnedBlockNumberStart  = IssueBlockNumberFinish
	OwnedBlockNumberFinish = OwnedBlockNumberStart + uint64ByteSize
)

structure of the ownership record

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

find owner currently owns this transaction id

func OwnerOf

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

find the owner of a specific transaction

func Transfer

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

need to have a lock

Types

type OwnedItem

type OwnedItem byte

the flag byte

const (
	OwnedAsset OwnedItem = iota
	OwnedBlock 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 currency to its string symbol

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

Jump to

Keyboard shortcuts

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