blocksign

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CreateDocumentsFactType = hint.Type("mitum-blocksign-create-documents-operation-fact")
	CreateDocumentsFactHint = hint.NewHint(CreateDocumentsFactType, "v0.0.1")
	CreateDocumentsType     = hint.Type("mitum-blocksign-create-documents-operation")
	CreateDocumentsHint     = hint.NewHint(CreateDocumentsType, "v0.0.1")
)
View Source
var (
	CreateDocumentsItemSingleFileType   = hint.Type("mitum-blocksign-create-documents-single-file")
	CreateDocumentsItemSingleFileHint   = hint.NewHint(CreateDocumentsItemSingleFileType, "v0.0.1")
	CreateDocumentsItemSingleFileHinter = BaseCreateDocumentsItem{/* contains filtered or unexported fields */}
)
View Source
var (
	DocumentDataType = hint.Type("mitum-blocksign-document-data")
	DocumentDataHint = hint.NewHint(DocumentDataType, "v0.0.1")
)
View Source
var (
	DocSignType = hint.Type("mitum-blocksign-docsign")
	DocSignHint = hint.NewHint(DocSignType, "v0.0.1")
)
View Source
var (
	DocInfoType = hint.Type("mitum-blocksign-document-info")
	DocInfoHint = hint.NewHint(DocInfoType, "v0.0.1")
)
View Source
var (
	DocIdType = hint.Type("mitum-blocksign-document-id")
	DocIdHint = hint.NewHint(DocIdType, "v0.0.1")
)
View Source
var (
	DocumentInventoryType = hint.Type("mbs-document-inventory")
	DocumentInventoryHint = hint.NewHint(DocumentInventoryType, "v0.0.1")
)
View Source
var (
	SignDocumentsFactType = hint.Type("mitum-blocksign-sign-documents-operation-fact")
	SignDocumentsFactHint = hint.NewHint(SignDocumentsFactType, "v0.0.1")
	SignDocumentsType     = hint.Type("mitum-blocksign-sign-documents-operation")
	SignDocumentsHint     = hint.NewHint(SignDocumentsType, "v0.0.1")
)
View Source
var (
	SignItemSingleDocumentType   = hint.Type("mitum-blocksign-sign-item-single-document")
	SignItemSingleDocumentHint   = hint.NewHint(SignItemSingleDocumentType, "v0.0.1")
	SignItemSingleDocumentHinter = BaseSignDocumentsItem{/* contains filtered or unexported fields */}
)
View Source
var (
	StateKeyDocumentsSuffix    = ":documents"
	StateKeyDocumentDataSuffix = ":documentData"
	StateKeyLastDocumentId     = "lastdocumentId"
)
View Source
var (
	TransferDocumentsFactType = hint.Type("mitum-blocksign-transfer-documents-operation-fact")
	TransferDocumentsFactHint = hint.NewHint(TransferDocumentsFactType, "v0.0.1")
	TransferDocumentsType     = hint.Type("mitum-blocksign-transfer-documents-operation")
	TransferDocumentsHint     = hint.NewHint(TransferDocumentsType, "v0.0.1")
)
View Source
var (
	TransfersItemSingleDocumentType   = hint.Type("mitum-blocksign-transfer-item-single-document")
	TransfersItemSingleDocumentHint   = hint.NewHint(TransfersItemSingleDocumentType, "v0.0.1")
	TransfersItemSingleDocumentHinter = BaseTransferDocumentsItem{/* contains filtered or unexported fields */}
)
View Source
var MaxCreateDocumentsItems uint = 10
View Source
var MaxSignDocumentsItems uint = 10
View Source
var MaxTransferDocumentsItems uint = 10

Functions

func CalculateDocumentItemsFee

func CalculateDocumentItemsFee(cp *currency.CurrencyPool, items []CreateDocumentsItem) (map[currency.CurrencyID][2]currency.Big, error)

func CheckDocumentOwnerEnoughBalance

func CheckDocumentOwnerEnoughBalance(
	holder base.Address,
	required map[currency.CurrencyID][2]currency.Big,
	getState func(key string) (state.State, bool, error),
) (map[currency.CurrencyID]currency.AmountState, error)

func CheckFactSignsByState

func CheckFactSignsByState(
	address base.Address,
	fs []operation.FactSign,
	getState func(string) (state.State, bool, error),
) error

func IsStateDocumentDataKey

func IsStateDocumentDataKey(key string) bool

func IsStateDocumentsKey

func IsStateDocumentsKey(key string) bool

func NewCreateDocumentsProcessor

func NewCreateDocumentsProcessor(cp *currency.CurrencyPool) currency.GetNewProcessor

func NewSignDocumentsProcessor

func NewSignDocumentsProcessor(cp *currency.CurrencyPool) currency.GetNewProcessor

func NewTransferDocumentsProcessor

func NewTransferDocumentsProcessor(cp *currency.CurrencyPool) currency.GetNewProcessor

func SetStateDocumentDataValue

func SetStateDocumentDataValue(st state.State, v DocumentData) (state.State, error)

func SetStateDocumentsValue

func SetStateDocumentsValue(st state.State, v DocumentInventory) (state.State, error)

func SetStateLastDocumentIdValue

func SetStateLastDocumentIdValue(st state.State, v DocId) (state.State, error)

func StateKeyDocumentData

func StateKeyDocumentData(fh FileHash) string

func StateKeyDocuments

func StateKeyDocuments(a base.Address) string

Types

type BaseCreateDocumentsItem

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

func NewBaseCreateDocumentsItem

func NewBaseCreateDocumentsItem(ht hint.Hint, filehash FileHash, signers []base.Address, cid currency.CurrencyID) BaseCreateDocumentsItem

func (BaseCreateDocumentsItem) Bytes

func (it BaseCreateDocumentsItem) Bytes() []byte

func (BaseCreateDocumentsItem) Currency

FileData return BaseCreateDocumentsItem's fileData.

func (BaseCreateDocumentsItem) FileHash

func (it BaseCreateDocumentsItem) FileHash() FileHash

FileHash return BaseCreateDocumetsItem's owner address.

func (BaseCreateDocumentsItem) Hint

func (it BaseCreateDocumentsItem) Hint() hint.Hint

func (BaseCreateDocumentsItem) IsValid

func (it BaseCreateDocumentsItem) IsValid([]byte) error

func (BaseCreateDocumentsItem) MarshalBSON

func (it BaseCreateDocumentsItem) MarshalBSON() ([]byte, error)

func (BaseCreateDocumentsItem) MarshalJSON

func (it BaseCreateDocumentsItem) MarshalJSON() ([]byte, error)

func (BaseCreateDocumentsItem) Rebuild

func (BaseCreateDocumentsItem) Signers

func (it BaseCreateDocumentsItem) Signers() []base.Address

func (*BaseCreateDocumentsItem) UnpackBSON

func (it *BaseCreateDocumentsItem) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*BaseCreateDocumentsItem) UnpackJSON

func (it *BaseCreateDocumentsItem) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type BaseSignDocumentsItem

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

func NewBaseSignDocumentsItem

func NewBaseSignDocumentsItem(ht hint.Hint, id currency.Big, owner base.Address, cid currency.CurrencyID) BaseSignDocumentsItem

func (BaseSignDocumentsItem) Bytes

func (it BaseSignDocumentsItem) Bytes() []byte

func (BaseSignDocumentsItem) Currency

FileData return BaseCreateDocumentsItem's fileData.

func (BaseSignDocumentsItem) DocumentId

func (it BaseSignDocumentsItem) DocumentId() currency.Big

FileHash return BaseCreateDocumetsItem's owner address.

func (BaseSignDocumentsItem) Hint

func (it BaseSignDocumentsItem) Hint() hint.Hint

func (BaseSignDocumentsItem) IsValid

func (it BaseSignDocumentsItem) IsValid([]byte) error

func (BaseSignDocumentsItem) MarshalBSON

func (it BaseSignDocumentsItem) MarshalBSON() ([]byte, error)

func (BaseSignDocumentsItem) MarshalJSON

func (it BaseSignDocumentsItem) MarshalJSON() ([]byte, error)

func (BaseSignDocumentsItem) Owner

func (it BaseSignDocumentsItem) Owner() base.Address

func (BaseSignDocumentsItem) Rebuild

func (*BaseSignDocumentsItem) UnpackBSON

func (it *BaseSignDocumentsItem) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*BaseSignDocumentsItem) UnpackJSON

func (it *BaseSignDocumentsItem) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type BaseTransferDocumentsItem

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

func NewBaseTransferDocumentsItem

func NewBaseTransferDocumentsItem(ht hint.Hint, docId currency.Big, owner base.Address, receiver base.Address, cid currency.CurrencyID) BaseTransferDocumentsItem

func (BaseTransferDocumentsItem) Bytes

func (it BaseTransferDocumentsItem) Bytes() []byte

func (BaseTransferDocumentsItem) Currency

func (BaseTransferDocumentsItem) DocumentId

func (it BaseTransferDocumentsItem) DocumentId() currency.Big

func (BaseTransferDocumentsItem) Hint

func (BaseTransferDocumentsItem) IsValid

func (it BaseTransferDocumentsItem) IsValid([]byte) error

func (BaseTransferDocumentsItem) MarshalBSON

func (it BaseTransferDocumentsItem) MarshalBSON() ([]byte, error)

func (BaseTransferDocumentsItem) MarshalJSON

func (it BaseTransferDocumentsItem) MarshalJSON() ([]byte, error)

func (BaseTransferDocumentsItem) Owner

func (BaseTransferDocumentsItem) Rebuild

func (BaseTransferDocumentsItem) Receiver

func (it BaseTransferDocumentsItem) Receiver() base.Address

func (*BaseTransferDocumentsItem) UnpackBSON

func (it *BaseTransferDocumentsItem) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*BaseTransferDocumentsItem) UnpackJSON

func (it *BaseTransferDocumentsItem) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type BaseTransferDocumentsItemBSONUnpacker

type BaseTransferDocumentsItemBSONUnpacker struct {
	DM currency.Big        `bson:"documentid"`
	OW base.AddressDecoder `bson:"owner"`
	RC base.AddressDecoder `bson:"receiver"`
	CI string              `bson:"currency"`
}

type BaseTransferDocumentsItemJSONUnpacker

type BaseTransferDocumentsItemJSONUnpacker struct {
	DI currency.Big        `json:"documentid"`
	OW base.AddressDecoder `json:"owner"`
	RC base.AddressDecoder `json:"receiver"`
	CI string              `json:"currency"`
}

type CreateDocuments

type CreateDocuments struct {
	operation.BaseOperation
	Memo string
}

func NewCreateDocuments

func NewCreateDocuments(fact CreateDocumentsFact, fs []operation.FactSign, memo string) (CreateDocuments, error)

func (CreateDocuments) AddFactSigns

func (CreateDocuments) GenerateHash

func (op CreateDocuments) GenerateHash() valuehash.Hash

func (CreateDocuments) Hint

func (op CreateDocuments) Hint() hint.Hint

func (CreateDocuments) IsValid

func (op CreateDocuments) IsValid(networkID []byte) error

func (CreateDocuments) MarshalBSON

func (op CreateDocuments) MarshalBSON() ([]byte, error)

func (CreateDocuments) MarshalJSON

func (op CreateDocuments) MarshalJSON() ([]byte, error)

func (CreateDocuments) Process

func (op CreateDocuments) Process(
	func(key string) (state.State, bool, error),
	func(valuehash.Hash, ...state.State) error,
) error

func (*CreateDocuments) UnpackBSON

func (op *CreateDocuments) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*CreateDocuments) UnpackJSON

func (op *CreateDocuments) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type CreateDocumentsFact

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

func NewCreateDocumentsFact

func NewCreateDocumentsFact(token []byte, sender base.Address, items []CreateDocumentsItem) CreateDocumentsFact

func (CreateDocumentsFact) Addresses

func (fact CreateDocumentsFact) Addresses() ([]base.Address, error)

func (CreateDocumentsFact) Bytes

func (fact CreateDocumentsFact) Bytes() []byte

func (CreateDocumentsFact) GenerateHash

func (fact CreateDocumentsFact) GenerateHash() valuehash.Hash

func (CreateDocumentsFact) Hash

func (fact CreateDocumentsFact) Hash() valuehash.Hash

func (CreateDocumentsFact) Hint

func (fact CreateDocumentsFact) Hint() hint.Hint

func (CreateDocumentsFact) IsValid

func (fact CreateDocumentsFact) IsValid([]byte) error

func (CreateDocumentsFact) Items

func (CreateDocumentsFact) MarshalBSON

func (fact CreateDocumentsFact) MarshalBSON() ([]byte, error)

func (CreateDocumentsFact) MarshalJSON

func (fact CreateDocumentsFact) MarshalJSON() ([]byte, error)

func (CreateDocumentsFact) Rebuild

func (CreateDocumentsFact) Sender

func (fact CreateDocumentsFact) Sender() base.Address

func (CreateDocumentsFact) Signers

func (fact CreateDocumentsFact) Signers() []base.Address

func (CreateDocumentsFact) Token

func (fact CreateDocumentsFact) Token() []byte

func (*CreateDocumentsFact) UnpackBSON

func (fact *CreateDocumentsFact) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*CreateDocumentsFact) UnpackJSON

func (fact *CreateDocumentsFact) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type CreateDocumentsFactBSONUnpacker

type CreateDocumentsFactBSONUnpacker struct {
	H  valuehash.Bytes     `bson:"hash"`
	TK []byte              `bson:"token"`
	SD base.AddressDecoder `bson:"sender"`
	IT bson.Raw            `bson:"items"`
}

type CreateDocumentsFactJSONPacker

type CreateDocumentsFactJSONPacker struct {
	jsonenc.HintedHead
	H  valuehash.Hash        `json:"hash"`
	TK []byte                `json:"token"`
	SD base.Address          `json:"sender"`
	IT []CreateDocumentsItem `json:"items"`
}

type CreateDocumentsFactJSONUnpacker

type CreateDocumentsFactJSONUnpacker struct {
	H  valuehash.Bytes     `json:"hash"`
	TK []byte              `json:"token"`
	SD base.AddressDecoder `json:"sender"`
	IT json.RawMessage     `json:"items"`
}

type CreateDocumentsItem

type CreateDocumentsItem interface {
	hint.Hinter
	isvalid.IsValider
	Bytes() []byte
	FileHash() FileHash
	Signers() []base.Address
	Currency() currency.CurrencyID
	Rebuild() CreateDocumentsItem
}

func DecodeCreateDocumentsItem

func DecodeCreateDocumentsItem(enc encoder.Encoder, b []byte) (CreateDocumentsItem, error)

type CreateDocumentsItemBSONUnpacker

type CreateDocumentsItemBSONUnpacker struct {
	FH string                `bson:"filehash"`
	SG []base.AddressDecoder `bson:"signers"`
	CI string                `bson:"currency"`
}

type CreateDocumentsItemJSONPacker

type CreateDocumentsItemJSONPacker struct {
	jsonenc.HintedHead
	FH FileHash            `json:"filehash"`
	SG []base.Address      `json:"signers"`
	CI currency.CurrencyID `json:"currency"`
}

type CreateDocumentsItemJSONUnpacker

type CreateDocumentsItemJSONUnpacker struct {
	FH string                `json:"filehash"`
	SG []base.AddressDecoder `json:"signers"`
	CI string                `json:"currency"`
}

type CreateDocumentsItemProcessor

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

func (*CreateDocumentsItemProcessor) PreProcess

func (opp *CreateDocumentsItemProcessor) PreProcess(
	getState func(key string) (state.State, bool, error),
	_ func(valuehash.Hash, ...state.State) error,
) error

func (*CreateDocumentsItemProcessor) Process

func (opp *CreateDocumentsItemProcessor) Process(
	_ func(key string) (state.State, bool, error),
	_ func(valuehash.Hash, ...state.State) error,
) ([]state.State, error)

type CreateDocumentsItemSingleFile

type CreateDocumentsItemSingleFile struct {
	BaseCreateDocumentsItem
}

func NewCreateDocumentsItemSingleFile

func NewCreateDocumentsItemSingleFile(
	fh FileHash,
	signers []base.Address,
	cid currency.CurrencyID,
) CreateDocumentsItemSingleFile

func (CreateDocumentsItemSingleFile) IsValid

type CreateDocumentsProcessor

type CreateDocumentsProcessor struct {
	CreateDocuments
	// contains filtered or unexported fields
}

func (*CreateDocumentsProcessor) PreProcess

func (opp *CreateDocumentsProcessor) PreProcess(
	getState func(key string) (state.State, bool, error),
	setState func(valuehash.Hash, ...state.State) error,
) (state.Processor, error)

func (*CreateDocumentsProcessor) Process

func (opp *CreateDocumentsProcessor) Process(
	getState func(key string) (state.State, bool, error),
	setState func(valuehash.Hash, ...state.State) error,
) error

type DocId

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

func MustNewDocId

func MustNewDocId(idx int64) DocId

func NewDocId

func NewDocId(idx int64) DocId

func NewDocIdFromString

func NewDocIdFromString(id string) (DocId, error)

func StateLastDocumentIdValue

func StateLastDocumentIdValue(st state.State) (DocId, error)

func (DocId) Bytes

func (di DocId) Bytes() []byte

func (DocId) Equal

func (di DocId) Equal(b DocInfo) bool

func (DocId) GenerateHash

func (di DocId) GenerateHash() valuehash.Hash

func (DocId) Hash

func (di DocId) Hash() valuehash.Hash

func (DocId) Hint

func (di DocId) Hint() hint.Hint

func (DocId) Index

func (di DocId) Index() currency.Big

func (DocId) IsEmpty

func (di DocId) IsEmpty() bool

func (DocId) IsValid

func (di DocId) IsValid([]byte) error

func (DocId) MarshalBSON

func (di DocId) MarshalBSON() ([]byte, error)

func (DocId) MarshalJSON

func (di DocId) MarshalJSON() ([]byte, error)

func (DocId) String

func (di DocId) String() string

func (*DocId) UnmarshalBSON

func (di *DocId) UnmarshalBSON(b []byte) error

func (*DocId) UnpackJSON

func (di *DocId) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

func (DocId) WithData

func (di DocId) WithData(idx currency.Big) DocId

type DocIdBSONPacker

type DocIdBSONPacker struct {
	ID currency.Big `bson:"documentid"`
}

type DocIdBSONUnpacker

type DocIdBSONUnpacker struct {
	ID currency.Big `bson:"documentid"`
}

type DocIdJSONPacker

type DocIdJSONPacker struct {
	jsonenc.HintedHead
	ID currency.Big `json:"documentid"`
}

type DocIdJSONUnpacker

type DocIdJSONUnpacker struct {
	ID currency.Big `json:"documentid"`
}

type DocInfo

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

func MustNewDocInfo

func MustNewDocInfo(idx int64, fh FileHash) DocInfo

func NewDocInfo

func NewDocInfo(idx int64, fh FileHash) DocInfo

func NewDocInfoFromString

func NewDocInfoFromString(id string, fh string) (DocInfo, error)

func (DocInfo) Bytes

func (di DocInfo) Bytes() []byte

func (DocInfo) Equal

func (di DocInfo) Equal(b DocInfo) bool

func (DocInfo) FileHash

func (di DocInfo) FileHash() FileHash

func (DocInfo) GenerateHash

func (di DocInfo) GenerateHash() valuehash.Hash

func (DocInfo) Hash

func (di DocInfo) Hash() valuehash.Hash

func (DocInfo) Hint

func (di DocInfo) Hint() hint.Hint

func (DocInfo) Index

func (di DocInfo) Index() currency.Big

func (DocInfo) IsEmpty

func (di DocInfo) IsEmpty() bool

func (DocInfo) IsValid

func (di DocInfo) IsValid([]byte) error

func (DocInfo) MarshalBSON

func (di DocInfo) MarshalBSON() ([]byte, error)

func (DocInfo) MarshalJSON

func (di DocInfo) MarshalJSON() ([]byte, error)

func (DocInfo) String

func (di DocInfo) String() string

func (*DocInfo) UnmarshalBSON

func (di *DocInfo) UnmarshalBSON(b []byte) error

func (*DocInfo) UnpackJSON

func (di *DocInfo) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

func (DocInfo) WithData

func (di DocInfo) WithData(idx currency.Big, fh FileHash) DocInfo

type DocInfoBSONPacker

type DocInfoBSONPacker struct {
	ID currency.Big `bson:"documentid"`
	FH FileHash     `bson:"filehash"`
}

type DocInfoBSONUnpacker

type DocInfoBSONUnpacker struct {
	ID currency.Big `bson:"documentid"`
	FH string       `bson:"filehash"`
}

type DocInfoJSONPacker

type DocInfoJSONPacker struct {
	jsonenc.HintedHead
	ID currency.Big `json:"documentid"`
	FH FileHash     `json:"filehash"`
}

type DocInfoJSONUnpacker

type DocInfoJSONUnpacker struct {
	ID currency.Big `json:"documentid"`
	FH string       `json:"filehash"`
}

type DocSign

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

func MustNewDocSign

func MustNewDocSign(address base.Address, signed bool) DocSign

func NewDocSign

func NewDocSign(address base.Address, signed bool) DocSign

func (DocSign) Address

func (doc DocSign) Address() base.Address

func (DocSign) Bytes

func (ds DocSign) Bytes() []byte

func (DocSign) Equal

func (ds DocSign) Equal(b DocSign) bool

func (DocSign) GenerateHash

func (ds DocSign) GenerateHash() valuehash.Hash

func (DocSign) Hash

func (ds DocSign) Hash() valuehash.Hash

func (DocSign) Hint

func (ds DocSign) Hint() hint.Hint

func (DocSign) IsEmpty

func (ds DocSign) IsEmpty() bool

func (DocSign) IsValid

func (ds DocSign) IsValid([]byte) error

func (DocSign) MarshalBSON

func (ds DocSign) MarshalBSON() ([]byte, error)

func (DocSign) MarshalJSON

func (ds DocSign) MarshalJSON() ([]byte, error)

func (*DocSign) SetSigned

func (ds *DocSign) SetSigned()

func (*DocSign) Signed

func (ds *DocSign) Signed() bool

func (DocSign) String

func (ds DocSign) String() string

func (*DocSign) UnpackBSON

func (ds *DocSign) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*DocSign) UnpackJSON

func (ds *DocSign) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type DocSignBSONPacker

type DocSignBSONPacker struct {
	AD base.Address `bson:"address"`
	SG bool         `bson:"signed"`
}

type DocSignBSONUnpacker

type DocSignBSONUnpacker struct {
	AD base.AddressDecoder `bson:"address"`
	SG bool                `bson:"signed"`
}

type DocSignJSONPacker

type DocSignJSONPacker struct {
	jsonenc.HintedHead
	AD base.Address `json:"address"`
	SG bool         `json:"signed"`
}

type DocSignJSONUnpacker

type DocSignJSONUnpacker struct {
	AD base.AddressDecoder `json:"address"`
	SG bool                `json:"signed"`
}

type DocumentBSONUnpacker

type DocumentBSONUnpacker struct {
	DI bson.Raw            `bson:"documentinfo"`
	CR base.AddressDecoder `bson:"creator"`
	OW base.AddressDecoder `bson:"owner"`
	SG bson.Raw            `bson:"signers"`
}

type DocumentData

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

func DecodeDocumentData

func DecodeDocumentData(b []byte, enc encoder.Encoder) (DocumentData, error)

func MustNewDocumentData

func MustNewDocumentData(info DocInfo, creator base.Address, owner base.Address, signers []DocSign) DocumentData

func NewDocumentData

func NewDocumentData(info DocInfo, creator base.Address, owner base.Address, signers []DocSign) DocumentData

func StateDocumentDataValue

func StateDocumentDataValue(st state.State) (DocumentData, error)

func (DocumentData) Addresses

func (doc DocumentData) Addresses() ([]base.Address, error)

func (DocumentData) Bytes

func (doc DocumentData) Bytes() []byte

func (DocumentData) Creator

func (doc DocumentData) Creator() base.Address

func (DocumentData) Equal

func (doc DocumentData) Equal(b DocumentData) bool

func (DocumentData) FileHash

func (doc DocumentData) FileHash() FileHash

func (DocumentData) GenerateHash

func (doc DocumentData) GenerateHash() valuehash.Hash

func (DocumentData) Hash

func (doc DocumentData) Hash() valuehash.Hash

func (DocumentData) Hint

func (doc DocumentData) Hint() hint.Hint

func (DocumentData) Info

func (doc DocumentData) Info() DocInfo

func (DocumentData) IsEmpty

func (doc DocumentData) IsEmpty() bool

func (DocumentData) IsValid

func (doc DocumentData) IsValid([]byte) error

func (DocumentData) MarshalBSON

func (doc DocumentData) MarshalBSON() ([]byte, error)

func (DocumentData) MarshalJSON

func (doc DocumentData) MarshalJSON() ([]byte, error)

func (DocumentData) Owner

func (doc DocumentData) Owner() base.Address

func (DocumentData) Signers

func (doc DocumentData) Signers() []DocSign

func (DocumentData) String

func (doc DocumentData) String() string

func (*DocumentData) UnpackBSON

func (doc *DocumentData) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*DocumentData) UnpackJSON

func (doc *DocumentData) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

func (DocumentData) WithData

func (doc DocumentData) WithData(docInfo DocInfo, creator base.Address, owner base.Address, signers []DocSign) DocumentData

type DocumentInventory

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

func NewDocumentInventory

func NewDocumentInventory(documents []DocInfo) DocumentInventory

func StateDocumentsValue

func StateDocumentsValue(st state.State) (DocumentInventory, error)

func (*DocumentInventory) Append

func (div *DocumentInventory) Append(d DocInfo) error

func (DocumentInventory) Bytes

func (div DocumentInventory) Bytes() []byte

func (DocumentInventory) Documents

func (div DocumentInventory) Documents() []DocInfo

func (DocumentInventory) Equal

func (DocumentInventory) Exists

func (div DocumentInventory) Exists(id currency.Big) bool

func (DocumentInventory) GenerateHash

func (div DocumentInventory) GenerateHash() valuehash.Hash

func (DocumentInventory) Get

func (div DocumentInventory) Get(id currency.Big) (DocInfo, error)

func (DocumentInventory) Hash

func (div DocumentInventory) Hash() valuehash.Hash

func (DocumentInventory) Hint

func (div DocumentInventory) Hint() hint.Hint

func (DocumentInventory) IsEmpty

func (div DocumentInventory) IsEmpty() bool

func (DocumentInventory) IsValid

func (div DocumentInventory) IsValid([]byte) error

func (DocumentInventory) MarshalBSON

func (div DocumentInventory) MarshalBSON() ([]byte, error)

func (DocumentInventory) MarshalJSON

func (div DocumentInventory) MarshalJSON() ([]byte, error)

func (*DocumentInventory) Romove

func (div *DocumentInventory) Romove(d DocInfo) error

func (*DocumentInventory) Sort

func (div *DocumentInventory) Sort(ascending bool)

func (*DocumentInventory) UnpackBSON

func (div *DocumentInventory) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*DocumentInventory) UnpackJSON

func (div *DocumentInventory) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type DocumentInventoryBSONPacker

type DocumentInventoryBSONPacker struct {
	DI []DocInfo `bson:"documents"`
}

type DocumentInventoryBSONUnpacker

type DocumentInventoryBSONUnpacker struct {
	DI bson.Raw `bson:"documents"`
}

type DocumentInventoryJSONPacker

type DocumentInventoryJSONPacker struct {
	jsonenc.HintedHead
	DI []DocInfo `json:"documents"`
}

type DocumentInventoryJSONUnpacker

type DocumentInventoryJSONUnpacker struct {
	DI json.RawMessage `json:"address"`
}

type DocumentJSONPacker

type DocumentJSONPacker struct {
	jsonenc.HintedHead
	DI DocInfo      `json:"documentinfo"`
	CR base.Address `json:"creator"`
	OW base.Address `json:"owner"`
	SG []DocSign    `json:"signers"`
}

type DocumentJSONUnpacker

type DocumentJSONUnpacker struct {
	DI json.RawMessage     `json:"documentinfo"`
	CR base.AddressDecoder `json:"creator"`
	OW base.AddressDecoder `json:"owner"`
	SG json.RawMessage     `json:"signers"`
}

type DuplicationType

type DuplicationType string
const (
	DuplicationTypeSender   DuplicationType = "sender"
	DuplicationTypeCurrency DuplicationType = "currency"
)

type FileHash

type FileHash string

func (FileHash) Bytes

func (fh FileHash) Bytes() []byte

func (FileHash) Equal

func (fh FileHash) Equal(b FileHash) bool

func (FileHash) IsValid

func (fh FileHash) IsValid([]byte) error

func (FileHash) String

func (fh FileHash) String() string

type GetNewProcessor

type GetNewProcessor func(state.Processor) (state.Processor, error)

type OperationProcessor

type OperationProcessor struct {
	sync.RWMutex
	*logging.Logging
	// contains filtered or unexported fields
}

func NewOperationProcessor

func NewOperationProcessor(cp *currency.CurrencyPool) *OperationProcessor

func (*OperationProcessor) Cancel

func (opr *OperationProcessor) Cancel() error

func (*OperationProcessor) Close

func (opr *OperationProcessor) Close() error

func (*OperationProcessor) New

func (*OperationProcessor) PreProcess

func (opr *OperationProcessor) PreProcess(op state.Processor) (state.Processor, error)

func (*OperationProcessor) Process

func (opr *OperationProcessor) Process(op state.Processor) error

func (*OperationProcessor) SetProcessor

func (opr *OperationProcessor) SetProcessor(
	hinter hint.Hinter,
	newProcessor currency.GetNewProcessor,
) (prprocessor.OperationProcessor, error)

type SignDocumentItem

type SignDocumentItem interface {
	hint.Hinter
	isvalid.IsValider
	Bytes() []byte
	DocumentId() currency.Big
	Owner() base.Address
	Currency() currency.CurrencyID
	Rebuild() SignDocumentItem
}

type SignDocuments

type SignDocuments struct {
	operation.BaseOperation
	Memo string
}

func NewSignDocuments

func NewSignDocuments(fact SignDocumentsFact, fs []operation.FactSign, memo string) (SignDocuments, error)

func (SignDocuments) AddFactSigns

func (op SignDocuments) AddFactSigns(fs ...operation.FactSign) (operation.FactSignUpdater, error)

func (SignDocuments) GenerateHash

func (op SignDocuments) GenerateHash() valuehash.Hash

func (SignDocuments) Hint

func (op SignDocuments) Hint() hint.Hint

func (SignDocuments) IsValid

func (op SignDocuments) IsValid(networkID []byte) error

func (SignDocuments) MarshalBSON

func (op SignDocuments) MarshalBSON() ([]byte, error)

func (SignDocuments) MarshalJSON

func (op SignDocuments) MarshalJSON() ([]byte, error)

func (SignDocuments) Process

func (op SignDocuments) Process(
	func(key string) (state.State, bool, error),
	func(valuehash.Hash, ...state.State) error,
) error

func (*SignDocuments) UnpackBSON

func (op *SignDocuments) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*SignDocuments) UnpackJSON

func (op *SignDocuments) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type SignDocumentsFact

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

func NewSignDocumentsFact

func NewSignDocumentsFact(token []byte, sender base.Address, items []SignDocumentItem) SignDocumentsFact

func (SignDocumentsFact) Addresses

func (fact SignDocumentsFact) Addresses() ([]base.Address, error)

func (SignDocumentsFact) Bytes

func (fact SignDocumentsFact) Bytes() []byte

func (SignDocumentsFact) GenerateHash

func (fact SignDocumentsFact) GenerateHash() valuehash.Hash

func (SignDocumentsFact) Hash

func (fact SignDocumentsFact) Hash() valuehash.Hash

func (SignDocumentsFact) Hint

func (fact SignDocumentsFact) Hint() hint.Hint

func (SignDocumentsFact) IsValid

func (fact SignDocumentsFact) IsValid([]byte) error

func (SignDocumentsFact) Items

func (fact SignDocumentsFact) Items() []SignDocumentItem

func (SignDocumentsFact) MarshalBSON

func (fact SignDocumentsFact) MarshalBSON() ([]byte, error)

func (SignDocumentsFact) MarshalJSON

func (fact SignDocumentsFact) MarshalJSON() ([]byte, error)

func (SignDocumentsFact) Rebuild

func (fact SignDocumentsFact) Rebuild() SignDocumentsFact

func (SignDocumentsFact) Sender

func (fact SignDocumentsFact) Sender() base.Address

func (SignDocumentsFact) Token

func (fact SignDocumentsFact) Token() []byte

func (*SignDocumentsFact) UnpackBSON

func (fact *SignDocumentsFact) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*SignDocumentsFact) UnpackJSON

func (fact *SignDocumentsFact) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type SignDocumentsFactBSONUnpacker

type SignDocumentsFactBSONUnpacker struct {
	H  valuehash.Bytes     `bson:"hash"`
	TK []byte              `bson:"token"`
	SD base.AddressDecoder `bson:"sender"`
	IT bson.Raw            `bson:"items"`
}

type SignDocumentsFactJSONPacker

type SignDocumentsFactJSONPacker struct {
	jsonenc.HintedHead
	H  valuehash.Hash     `json:"hash"`
	TK []byte             `json:"token"`
	SD base.Address       `json:"sender"`
	IT []SignDocumentItem `json:"items"`
}

type SignDocumentsFactJSONUnpacker

type SignDocumentsFactJSONUnpacker struct {
	H  valuehash.Bytes     `json:"hash"`
	TK []byte              `json:"token"`
	SD base.AddressDecoder `json:"sender"`
	IT json.RawMessage     `json:"items"`
}

type SignDocumentsItemBSONUnpacker

type SignDocumentsItemBSONUnpacker struct {
	DI currency.Big        `bson:"documentid"`
	OW base.AddressDecoder `bson:"owner"`
	CI string              `bson:"currency"`
}

type SignDocumentsItemJSONPacker

type SignDocumentsItemJSONPacker struct {
	jsonenc.HintedHead
	DI currency.Big        `json:"documentid"`
	OW base.Address        `json:"owner"`
	CI currency.CurrencyID `json:"currency"`
}

type SignDocumentsItemJSONUnpacker

type SignDocumentsItemJSONUnpacker struct {
	DI currency.Big        `json:"documentid"`
	OW base.AddressDecoder `json:"owner"`
	CI string              `json:"currency"`
}

type SignDocumentsItemProcessor

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

func (*SignDocumentsItemProcessor) PreProcess

func (opp *SignDocumentsItemProcessor) PreProcess(
	getState func(key string) (state.State, bool, error),
	_ func(valuehash.Hash, ...state.State) error,
) error

func (*SignDocumentsItemProcessor) Process

func (opp *SignDocumentsItemProcessor) Process(
	_ func(key string) (state.State, bool, error),
	_ func(valuehash.Hash, ...state.State) error,
) ([]state.State, error)

type SignDocumentsItemSingleFile

type SignDocumentsItemSingleFile struct {
	BaseSignDocumentsItem
}

func NewSignDocumentsItemSingleFile

func NewSignDocumentsItemSingleFile(docId currency.Big, owner base.Address, cid currency.CurrencyID) SignDocumentsItemSingleFile

func (SignDocumentsItemSingleFile) IsValid

func (it SignDocumentsItemSingleFile) IsValid([]byte) error

func (SignDocumentsItemSingleFile) Rebuild

type SignDocumentsProcessor

type SignDocumentsProcessor struct {
	SignDocuments
	// contains filtered or unexported fields
}

func (*SignDocumentsProcessor) PreProcess

func (opp *SignDocumentsProcessor) PreProcess(
	getState func(key string) (state.State, bool, error),
	setState func(valuehash.Hash, ...state.State) error,
) (state.Processor, error)

func (*SignDocumentsProcessor) Process

func (opp *SignDocumentsProcessor) Process(
	getState func(key string) (state.State, bool, error),
	setState func(valuehash.Hash, ...state.State) error,
) error

type TransferDocuments

type TransferDocuments struct {
	operation.BaseOperation
	Memo string
}

func NewTransferDocuments

func NewTransferDocuments(fact TransferDocumentsFact, fs []operation.FactSign, memo string) (TransferDocuments, error)

func (TransferDocuments) AddFactSigns

func (TransferDocuments) GenerateHash

func (op TransferDocuments) GenerateHash() valuehash.Hash

func (TransferDocuments) Hint

func (op TransferDocuments) Hint() hint.Hint

func (TransferDocuments) IsValid

func (op TransferDocuments) IsValid(networkID []byte) error

func (TransferDocuments) MarshalBSON

func (op TransferDocuments) MarshalBSON() ([]byte, error)

func (TransferDocuments) MarshalJSON

func (op TransferDocuments) MarshalJSON() ([]byte, error)

func (TransferDocuments) Process

func (op TransferDocuments) Process(
	func(key string) (state.State, bool, error),
	func(valuehash.Hash, ...state.State) error,
) error

func (*TransferDocuments) UnpackBSON

func (op *TransferDocuments) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*TransferDocuments) UnpackJSON

func (op *TransferDocuments) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type TransferDocumentsFact

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

func NewTransferDocumentsFact

func NewTransferDocumentsFact(token []byte, sender base.Address, items []TransferDocumentsItem) TransferDocumentsFact

func (TransferDocumentsFact) Addresses

func (fact TransferDocumentsFact) Addresses() ([]base.Address, error)

func (TransferDocumentsFact) Bytes

func (fact TransferDocumentsFact) Bytes() []byte

func (TransferDocumentsFact) GenerateHash

func (fact TransferDocumentsFact) GenerateHash() valuehash.Hash

func (TransferDocumentsFact) Hash

func (fact TransferDocumentsFact) Hash() valuehash.Hash

func (TransferDocumentsFact) Hint

func (fact TransferDocumentsFact) Hint() hint.Hint

func (TransferDocumentsFact) IsValid

func (fact TransferDocumentsFact) IsValid([]byte) error

func (TransferDocumentsFact) Items

func (TransferDocumentsFact) MarshalBSON

func (fact TransferDocumentsFact) MarshalBSON() ([]byte, error)

func (TransferDocumentsFact) MarshalJSON

func (fact TransferDocumentsFact) MarshalJSON() ([]byte, error)

func (TransferDocumentsFact) Rebuild

func (TransferDocumentsFact) Sender

func (fact TransferDocumentsFact) Sender() base.Address

func (TransferDocumentsFact) Targets

func (fact TransferDocumentsFact) Targets() ([]base.Address, error)

func (TransferDocumentsFact) Token

func (fact TransferDocumentsFact) Token() []byte

func (*TransferDocumentsFact) UnpackBSON

func (fact *TransferDocumentsFact) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*TransferDocumentsFact) UnpackJSON

func (fact *TransferDocumentsFact) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type TransferDocumentsFactBSONUnpacker

type TransferDocumentsFactBSONUnpacker struct {
	H  valuehash.Bytes     `bson:"hash"`
	TK []byte              `bson:"token"`
	SD base.AddressDecoder `bson:"sender"`
	IT []bson.Raw          `bson:"items"`
}

type TransferDocumentsFactJSONPacker

type TransferDocumentsFactJSONPacker struct {
	jsonenc.HintedHead
	H  valuehash.Hash          `json:"hash"`
	TK []byte                  `json:"token"`
	SD base.Address            `json:"sender"`
	IT []TransferDocumentsItem `json:"items"`
}

type TransferDocumentsItem

type TransferDocumentsItem interface {
	hint.Hinter
	isvalid.IsValider
	Bytes() []byte
	DocumentId() currency.Big
	Owner() base.Address
	Receiver() base.Address
	Currency() currency.CurrencyID
	Rebuild() TransferDocumentsItem
}

func DecodeTransferDocumentsItem

func DecodeTransferDocumentsItem(enc encoder.Encoder, b []byte) (TransferDocumentsItem, error)

type TransferDocumentsItemJSONPacker

type TransferDocumentsItemJSONPacker struct {
	jsonenc.HintedHead
	DI currency.Big        `json:"documentid"`
	OW base.Address        `json:"owner"`
	RC base.Address        `json:"receiver"`
	CI currency.CurrencyID `json:"currency"`
}

type TransferDocumentsItemProcessor

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

func (*TransferDocumentsItemProcessor) PreProcess

func (opp *TransferDocumentsItemProcessor) PreProcess(
	getState func(key string) (state.State, bool, error),
	_ func(valuehash.Hash, ...state.State) error,
) error

func (*TransferDocumentsItemProcessor) Process

func (opp *TransferDocumentsItemProcessor) Process(
	getState func(key string) (state.State, bool, error),
	_ func(valuehash.Hash, ...state.State) error,
) ([]state.State, error)

type TransferDocumentsItemSingleFile

type TransferDocumentsItemSingleFile struct {
	BaseTransferDocumentsItem
}

func NewTransferDocumentsItemSingleFile

func NewTransferDocumentsItemSingleFile(docId currency.Big, owner base.Address, receiver base.Address, cid currency.CurrencyID) TransferDocumentsItemSingleFile

func (TransferDocumentsItemSingleFile) IsValid

func (TransferDocumentsItemSingleFile) Rebuild

type TransferDocumentsProcessor

type TransferDocumentsProcessor struct {
	TransferDocuments
	// contains filtered or unexported fields
}

func (*TransferDocumentsProcessor) PreProcess

func (opp *TransferDocumentsProcessor) PreProcess(
	getState func(key string) (state.State, bool, error),
	setState func(valuehash.Hash, ...state.State) error,
) (state.Processor, error)

func (*TransferDocumentsProcessor) Process

func (opp *TransferDocumentsProcessor) Process(
	getState func(key string) (state.State, bool, error),
	setState func(valuehash.Hash, ...state.State) error,
) error

Jump to

Keyboard shortcuts

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