Documentation ¶
Index ¶
- Constants
- func CheckValidatorType(ctx context.Context, validator ValidatorType) error
- func FFEnumValues(t string) []interface{}
- func ParseToByteSize(byteString string) int64
- func ParseToDuration(durationString string) time.Duration
- func SafeHashCompare(h1 *Bytes32, h2 *Bytes32) bool
- func ShortID() string
- func ToStringArray(unknown interface{}) ([]string, bool)
- func TokenAccountIdentifier(protocolID, tokenIndex, identity string) string
- func ValidateFFNameField(ctx context.Context, str string, fieldName string) error
- func ValidateLength(ctx context.Context, str string, fieldName string, max int) error
- type Batch
- type BatchPayload
- type BigInt
- type Blob
- type BlobRef
- type Byteable
- func (h Byteable) Hash() *Bytes32
- func (h Byteable) JSONObject() JSONObject
- func (h Byteable) JSONObjectOk() (JSONObject, bool)
- func (h Byteable) MarshalJSON() ([]byte, error)
- func (h *Byteable) Scan(src interface{}) error
- func (h Byteable) String() string
- func (h *Byteable) UnmarshalJSON(b []byte) error
- type Bytes32
- type ChangeEvent
- type ChangeEventType
- type ConfigRecord
- type DXInfo
- type Data
- type DataAndBlob
- type DataRef
- type DataRefOrValue
- type DataRefs
- type Datatype
- type DatatypeRef
- type Definition
- type EmptyInput
- type Event
- type EventDelivery
- type EventDeliveryResponse
- type EventType
- type FFDuration
- type FFEnum
- type FFNameArray
- type FFTime
- type Group
- type GroupIdentity
- type HexUUID
- type Identity
- type InlineData
- type InputGroup
- type JSONObject
- func (jd JSONObject) GetBool(key string) bool
- func (jd JSONObject) GetObject(key string) JSONObject
- func (jd JSONObject) GetObjectArray(key string) JSONObjectArray
- func (jd JSONObject) GetObjectArrayOk(key string) (JSONObjectArray, bool)
- func (jd JSONObject) GetObjectOk(key string) (JSONObject, bool)
- func (jd JSONObject) GetString(key string) string
- func (jd JSONObject) GetStringArray(key string) []string
- func (jd JSONObject) GetStringArrayOk(key string) ([]string, bool)
- func (jd JSONObject) GetStringOk(key string) (string, bool)
- func (jd JSONObject) Hash(jsonDesc string) (*Bytes32, error)
- func (jd *JSONObject) Scan(src interface{}) error
- func (jd JSONObject) String() string
- func (jd JSONObject) Value() (driver.Value, error)
- type JSONObjectArray
- type LocallySequenced
- type Member
- type MemberInput
- type Members
- type Message
- type MessageHeader
- type MessageInOut
- type MessageRef
- type MessageType
- type Multipart
- type Named
- type Namespace
- type NamespaceType
- type NextPin
- type Node
- type NodeStatus
- type NodeStatusDefaults
- type NodeStatusNode
- type NodeStatusOrg
- type Nonce
- type Offset
- type OffsetType
- type OpStatus
- type OpType
- type Operation
- type Organization
- type Pin
- type RESTError
- type SortableBool
- type SubOptsFirstEvent
- type Subscription
- type SubscriptionCoreOptions
- type SubscriptionFilter
- type SubscriptionOptions
- func (so SubscriptionOptions) MarshalJSON() ([]byte, error)
- func (so *SubscriptionOptions) Scan(src interface{}) error
- func (so *SubscriptionOptions) TransportOptions() JSONObject
- func (so *SubscriptionOptions) UnmarshalJSON(b []byte) error
- func (so SubscriptionOptions) Value() (driver.Value, error)
- type SubscriptionRef
- type SystemTag
- type TokenAccount
- type TokenBalanceChange
- type TokenPool
- type TokenPoolAnnouncement
- type TokenTransfer
- type TokenTransferInput
- type TokenTransferType
- type TokenType
- type Transaction
- type TransactionRef
- type TransactionSubject
- type TransactionType
- type TransportPayloadType
- type TransportWrapper
- type UUID
- func (u *UUID) Equals(u2 *UUID) bool
- func (u UUID) MarshalBinary() ([]byte, error)
- func (u UUID) MarshalText() ([]byte, error)
- func (u *UUID) Scan(src interface{}) error
- func (u *UUID) String() string
- func (u *UUID) UnmarshalBinary(b []byte) error
- func (u *UUID) UnmarshalText(b []byte) error
- func (u *UUID) Value() (driver.Value, error)
- type ValidatorType
- type WSChangeNotification
- type WSClientActionAckPayload
- type WSClientActionBase
- type WSClientActionStartPayload
- type WSClientPayloadType
- type WSProtocolErrorPayload
Constants ¶
const (
// DefaultTopic will be set as the topic of any messages set without a topic
DefaultTopic = "default"
)
const (
FireflyOrgDIDPrefix = "did:firefly:org/"
)
const MaxBigIntHexLength = 65
const (
// ShortIDlphabet is designed for easy double-click select
ShortIDlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
)
const (
// SystemNamespace is the system reserved namespace name
SystemNamespace = "ff_system"
)
Variables ¶
This section is empty.
Functions ¶
func CheckValidatorType ¶
func CheckValidatorType(ctx context.Context, validator ValidatorType) error
func FFEnumValues ¶
func FFEnumValues(t string) []interface{}
func ParseToByteSize ¶
ParseToByteSize is a standard handling of a number of bytes, in config or API options
func ParseToDuration ¶
ParseToDuration is a standard handling of any duration string, in config or API options
func SafeHashCompare ¶
func ToStringArray ¶
func TokenAccountIdentifier ¶
func ValidateFFNameField ¶
Types ¶
type Batch ¶
type Batch struct { ID *UUID `json:"id"` Namespace string `json:"namespace"` Type MessageType `json:"type"` Identity Group *Bytes32 `jdon:"group,omitempty"` Hash *Bytes32 `json:"hash"` Created *FFTime `json:"created"` Confirmed *FFTime `json:"confirmed"` Payload BatchPayload `json:"payload"` PayloadRef string `json:"payloadRef,omitempty"` Blobs []*Bytes32 `json:"blobs,omitempty"` // only used in-flight }
type BatchPayload ¶
type BatchPayload struct { TX TransactionRef `json:"tx"` Messages []*Message `json:"messages"` Data []*Data `json:"data"` }
func (*BatchPayload) Hash ¶
func (ma *BatchPayload) Hash() *Bytes32
func (*BatchPayload) Scan ¶
func (ma *BatchPayload) Scan(src interface{}) error
Scan implements sql.Scanner
type BigInt ¶
BigInt is a wrapper on a Go big.Int that standardizes JSON and DB serialization
func (BigInt) MarshalText ¶
func (*BigInt) UnmarshalJSON ¶
type Byteable ¶
type Byteable []byte
Byteable uses raw encode/decode to preserve field order, and can handle any types of field. It validates the JSON can be unmarshalled, but does not change the order. It does however trim out whitespace
func (Byteable) JSONObject ¶
func (h Byteable) JSONObject() JSONObject
JSONObject attempts to de-serailize the contained structure as a JSON Object (map) Will fail if the type is array, string, bool, number etc.
func (Byteable) JSONObjectOk ¶
func (h Byteable) JSONObjectOk() (JSONObject, bool)
func (Byteable) MarshalJSON ¶
func (*Byteable) UnmarshalJSON ¶
type Bytes32 ¶
type Bytes32 [32]byte
Bytes32 is a holder of a hash, that can be used to correlate onchain data with off-chain data.
func HashResult ¶
func NewRandB32 ¶
func NewRandB32() *Bytes32
func (Bytes32) MarshalText ¶
func (*Bytes32) UnmarshalText ¶
type ChangeEvent ¶
type ChangeEvent struct { // The resource collection where the changed resource exists Collection string `json:"collection"` // The type of event Type ChangeEventType `json:"type"` // Namespace is set if there is a namespace associated with the changed resource Namespace string `json:"namespace,omitempty"` // UUID is set if the resource is identified by ID ID *UUID `json:"id,omitempty"` // Hash is set if the resource is identified primarily by hash (groups is currently the only example) Hash *Bytes32 `json:"hash,omitempty"` // Sequence is set if there is a local ordered sequence associated with the changed resource Sequence *int64 `json:"sequence,omitempty"` }
ChangeEvent is a change to the local FireFly core node.
type ChangeEventType ¶
type ChangeEventType string
ChangeEventType
const ( ChangeEventTypeCreated ChangeEventType = "created" ChangeEventTypeUpdated ChangeEventType = "updated" // note bulk updates might not results in change events. ChangeEventTypeDeleted ChangeEventType = "deleted" )
type ConfigRecord ¶
type DXInfo ¶
type DXInfo struct { Peer string `json:"peer,omitempty"` Endpoint JSONObject `json:"endpoint,omitempty"` }
DXInfo is the data exchange information
type Data ¶
type Data struct { ID *UUID `json:"id,omitempty"` Validator ValidatorType `json:"validator"` Namespace string `json:"namespace,omitempty"` Hash *Bytes32 `json:"hash,omitempty"` Created *FFTime `json:"created,omitempty"` Datatype *DatatypeRef `json:"datatype,omitempty"` Value Byteable `json:"value"` Blob *BlobRef `json:"blob,omitempty"` }
type DataAndBlob ¶
type DataRefOrValue ¶
type DataRefOrValue struct { DataRef Validator ValidatorType `json:"validator,omitempty"` Datatype *DatatypeRef `json:"datatype,omitempty"` Value Byteable `json:"value,omitempty"` Blob *BlobRef `json:"blob,omitempty"` }
DataRefOrValue allows a value to be specified in-line in the data array of an input message, avoiding the need for a multiple API calls.
type Datatype ¶
type Datatype struct { ID *UUID `json:"id,omitempty"` Message *UUID `json:"message,omitempty"` Validator ValidatorType `json:"validator" ffenum:"validatortype"` Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Hash *Bytes32 `json:"hash,omitempty"` Created *FFTime `json:"created,omitempty"` Value Byteable `json:"value,omitempty"` }
Datatype is the structure defining a data definition, such as a JSON schema
func (*Datatype) SetBroadcastMessage ¶
type DatatypeRef ¶
type DatatypeRef struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` }
func (*DatatypeRef) String ¶
func (dr *DatatypeRef) String() string
type Definition ¶
type Definition interface { // Topic returns the topic on which the object should be broadcast Topic() string // SetBroadcastMessage sets the message that broadcast the definition SetBroadcastMessage(msgID *UUID) }
Definition is implemented by all objects that can be broadcast as system definitions to the network
type EmptyInput ¶
type EmptyInput struct{}
EmptyInput represents an API with no input fields, but requiring a JSON content type on the request
type Event ¶
type Event struct { ID *UUID `json:"id"` Sequence int64 `json:"sequence"` Type EventType `json:"type" ffenum:"eventtype"` Namespace string `json:"namespace"` Reference *UUID `json:"reference"` Created *FFTime `json:"created"` }
Event is an activity in the system, delivered reliably to applications, that indicates something has happened in the network
func (*Event) LocalSequence ¶
type EventDelivery ¶
type EventDelivery struct { Event Subscription SubscriptionRef `json:"subscription"` Message *Message `json:"message,omitempty"` }
EventDelivery adds the referred object to an event, as well as details of the subscription that caused the event to be dispatched to an applciation.
type EventDeliveryResponse ¶
type EventDeliveryResponse struct { ID *UUID `json:"id"` Rejected bool `json:"rejected,omitempty"` Info string `json:"info,omitempty"` Subscription SubscriptionRef `json:"subscription"` Reply *MessageInOut `json:"reply,omitempty"` }
EventDeliveryResponse is the payload an application sends back, to confirm it has accepted (or rejected) the event and as such does not need to receive it again.
type EventType ¶
type EventType = FFEnum
EventType indicates what the event means, as well as what the Reference in the event refers to
var ( // EventTypeMessageConfirmed is the most important event type in the system. This means a message and all of its data // is available for processing by an application. Most applications only need to listen to this event type EventTypeMessageConfirmed EventType = ffEnum("eventtype", "message_confirmed") // EventTypeMessageRejected occurs if a message is received and confirmed from a sequencing perspective, but is rejected as invalid (mismatch to schema, or duplicate system broadcast) EventTypeMessageRejected EventType = ffEnum("eventtype", "message_rejected") // EventTypeNamespaceConfirmed occurs when a new namespace is ready for use (on the namespace itself) EventTypeNamespaceConfirmed EventType = ffEnum("eventtype", "namespace_confirmed") // EventTypeDatatypeConfirmed occurs when a new datatype is ready for use (on the namespace of the datatype) EventTypeDatatypeConfirmed EventType = ffEnum("eventtype", "datatype_confirmed") // EventTypeGroupConfirmed occurs when a new group is ready to use (on the namespace of the group, on all group participants) EventTypeGroupConfirmed EventType = ffEnum("eventtype", "group_confirmed") // EventTypePoolConfirmed occurs when a new token pool is ready for use EventTypePoolConfirmed EventType = ffEnum("eventtype", "token_pool_confirmed") // EventTypePoolRejected occurs when a new token pool is rejected (due to validation errors, duplicates, etc) EventTypePoolRejected EventType = ffEnum("eventtype", "token_pool_rejected") // EventTypeTransferConfirmed occurs when a token transfer has been confirmed EventTypeTransferConfirmed EventType = ffEnum("eventtype", "token_transfer_confirmed") )
type FFDuration ¶
FFDuration is serialized to JSON in the string format of time.Duration It can be unmarshalled from a number, or a string. - If it is a string in time.Duration format, that will be used - If it is a string that can be parsed as an int64, that will be used in Milliseconds - If it is a number, that will be used in Milliseconds
func ParseDurationString ¶
func ParseDurationString(durationString string, def time.Duration) (FFDuration, error)
ParseDurationString is a standard handling of any duration string, in config or API options
func (*FFDuration) MarshalJSON ¶
func (fd *FFDuration) MarshalJSON() ([]byte, error)
func (*FFDuration) Scan ¶
func (fd *FFDuration) Scan(src interface{}) error
Scan implements sql.Scanner
func (*FFDuration) String ¶
func (fd *FFDuration) String() string
func (*FFDuration) UnmarshalJSON ¶
func (fd *FFDuration) UnmarshalJSON(b []byte) error
type FFNameArray ¶
type FFNameArray []string
FFNameArray is an array of strings, each conforming to the requirements of a FireFly name, with a combined length (when joined with commas) of 1024
func (*FFNameArray) Scan ¶
func (na *FFNameArray) Scan(src interface{}) error
func (FFNameArray) String ¶
func (na FFNameArray) String() string
type FFTime ¶
FFTime is serialized to JSON on the API in RFC3339 nanosecond UTC time (noting that JavaScript can parse this format happily into millisecond time with Date.pase()). It is persisted as a nanosecond resolution timestamp in the database. It can be parsed from RFC3339, or unix timestamps (second, millisecond or nanosecond resolution)
func ParseString ¶
func (*FFTime) MarshalJSON ¶
func (*FFTime) UnmarshalText ¶
type Group ¶
type Group struct { GroupIdentity Message *UUID `json:"message,omitempty"` Hash *Bytes32 `json:"hash,omitempty"` Created *FFTime `json:"created,omitempty"` }
func (*Group) SetBroadcastMessage ¶
type GroupIdentity ¶
type GroupIdentity struct { Ledger *UUID `json:"ledger,omitempty"` Namespace string `json:"namespace,omitempty"` Name string `json:"name"` Members Members `json:"members"` }
func (*GroupIdentity) Hash ¶
func (man *GroupIdentity) Hash() *Bytes32
type HexUUID ¶
type HexUUID = Bytes32
HexUUID is 32 character ASCII string containing the hex representation of UUID, with the dashes of the canonical representation removed
type Identity ¶
Identity is the nested structure representing an identity, that might comprise a resolvable by FireFly identity DID, a blockchain signing key, or both.
type InlineData ¶
type InlineData []*DataRefOrValue
InlineData is an array of data references or values
type InputGroup ¶
type InputGroup struct { Name string `json:"name,omitempty"` Ledger *UUID `json:"ledger,omitempty"` Members []MemberInput `json:"members"` }
InputGroup declares a group in-line for auotmatic resolution, without having to define a group up-front
type JSONObject ¶
type JSONObject map[string]interface{}
JSONObject is a holder of a hash, that can be used to correlate onchain data with off-chain data.
func (JSONObject) GetBool ¶
func (jd JSONObject) GetBool(key string) bool
func (JSONObject) GetObject ¶
func (jd JSONObject) GetObject(key string) JSONObject
func (JSONObject) GetObjectArray ¶
func (jd JSONObject) GetObjectArray(key string) JSONObjectArray
func (JSONObject) GetObjectArrayOk ¶
func (jd JSONObject) GetObjectArrayOk(key string) (JSONObjectArray, bool)
func (JSONObject) GetObjectOk ¶
func (jd JSONObject) GetObjectOk(key string) (JSONObject, bool)
func (JSONObject) GetString ¶
func (jd JSONObject) GetString(key string) string
func (JSONObject) GetStringArray ¶
func (jd JSONObject) GetStringArray(key string) []string
func (JSONObject) GetStringArrayOk ¶
func (jd JSONObject) GetStringArrayOk(key string) ([]string, bool)
func (JSONObject) GetStringOk ¶
func (jd JSONObject) GetStringOk(key string) (string, bool)
func (*JSONObject) Scan ¶
func (jd *JSONObject) Scan(src interface{}) error
Scan implements sql.Scanner
func (JSONObject) String ¶
func (jd JSONObject) String() string
type JSONObjectArray ¶
type JSONObjectArray []JSONObject
JSONObjectArray is an array of JSONObject
func ToJSONObjectArray ¶
func ToJSONObjectArray(unknown interface{}) (JSONObjectArray, bool)
func (*JSONObjectArray) Scan ¶
func (jd *JSONObjectArray) Scan(src interface{}) error
Scan implements sql.Scanner
func (JSONObjectArray) String ¶
func (jd JSONObjectArray) String() string
type LocallySequenced ¶
type LocallySequenced interface {
LocalSequence() int64
}
type MemberInput ¶
type Message ¶
type Message struct { Header MessageHeader `json:"header"` Hash *Bytes32 `json:"hash,omitempty"` BatchID *UUID `json:"batch,omitempty"` Local bool `json:"local,omitempty"` Rejected bool `json:"rejected,omitempty"` Pending SortableBool `json:"pending"` Confirmed *FFTime `json:"confirmed,omitempty"` Data DataRefs `json:"data"` Pins FFNameArray `json:"pins,omitempty"` Sequence int64 `json:"-"` // Local database sequence used internally for batch assembly }
Message is the envelope by which coordinated data exchange can happen between parties in the network Data is passed by reference in these messages, and a chain of hashes covering the data and the details of the message, provides a verification against tampering.
func (*Message) LocalSequence ¶
type MessageHeader ¶
type MessageHeader struct { ID *UUID `json:"id,omitempty"` CID *UUID `json:"cid,omitempty"` Type MessageType `json:"type" ffenum:"messagetype"` TxType TransactionType `json:"txtype,omitempty"` Identity Created *FFTime `json:"created,omitempty"` Namespace string `json:"namespace,omitempty"` Group *Bytes32 `json:"group,omitempty"` Topics FFNameArray `json:"topics,omitempty"` Tag string `json:"tag,omitempty"` DataHash *Bytes32 `json:"datahash,omitempty"` }
MessageHeader contains all fields that contribute to the hash The order of the serialization mut not change, once released
func (*MessageHeader) Hash ¶
func (h *MessageHeader) Hash() *Bytes32
type MessageInOut ¶
type MessageInOut struct { Message InlineData InlineData `json:"data"` Group *InputGroup `json:"group,omitempty"` }
MessageInOut allows API users to submit values in-line in the payload submitted, which will be broken out and stored separately during the call.
func (*MessageInOut) SetInlineData ¶
func (m *MessageInOut) SetInlineData(data []*Data)
type MessageRef ¶
type MessageRef struct { ID *UUID `json:"id,omitempty"` Sequence int64 `json:"sequence,omitempty"` Hash *Bytes32 `json:"hash,omitempty"` }
MessageRef is a lightweight data structure that can be used to refer to a message
type MessageType ¶
type MessageType = FFEnum
MessageType is the fundamental type of a message
var ( // MessageTypeDefinition is a message broadcasting a definition of a system type, pre-defined by firefly (namespaces, members, data definitions, etc.) MessageTypeDefinition MessageType = ffEnum("messagetype", "definition") // MessageTypeBroadcast is a broadcast message, meaning it is intended to be visible by all parties in the network MessageTypeBroadcast MessageType = ffEnum("messagetype", "broadcast") // MessageTypePrivate is a private message, meaning it is only sent explicitly to individual parties in the network MessageTypePrivate MessageType = ffEnum("messagetype", "private") // MessageTypeGroupInit is a special private message that contains the definition of the group MessageTypeGroupInit MessageType = ffEnum("messagetype", "groupinit") // MessageTypeTransferBroadcast is a broadcast message to accompany/annotate a token transfer MessageTypeTransferBroadcast MessageType = ffEnum("messagetype", "transfer_broadcast") // MessageTypeTransferPrivate is a private message to accompany/annotate a token transfer MessageTypeTransferPrivate MessageType = ffEnum("messagetype", "transfer_private") )
type Namespace ¶
type Namespace struct { ID *UUID `json:"id"` Message *UUID `json:"message,omitempty"` Name string `json:"name"` Description string `json:"description"` Type NamespaceType `json:"type" ffenum:"namespacetype"` Created *FFTime `json:"created"` }
Namespace is a isolate set of named resources, to allow multiple applications to co-exist in the same network, with the same named objects. Can be used for use case segregation, or multi-tenancy.
func (*Namespace) SetBroadcastMessage ¶
type NamespaceType ¶
type NamespaceType = FFEnum
NamespaceType describes when the namespace was created from local configuration, or broadcast through the network
var ( // NamespaceTypeLocal is a namespace that only exists because it was defined in the local configuration of the node NamespaceTypeLocal NamespaceType = ffEnum("namespacetype", "local") // NamespaceTypeBroadcast is a namespace that was broadcast through the network. Broadcast namespaces can overwrite a local namespace NamespaceTypeBroadcast NamespaceType = ffEnum("namespacetype", "broadcast") // NamespaceTypeSystem is a reserved namespace used by FireFly itself NamespaceTypeSystem NamespaceType = ffEnum("namespacetype", "system") )
type Node ¶
type Node struct { ID *UUID `json:"id"` Message *UUID `json:"message,omitempty"` Owner string `json:"owner,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` DX DXInfo `json:"dx"` Created *FFTime `json:"created,omitempty"` }
Node is a FireFly node within the network
func (*Node) SetBroadcastMessage ¶
type NodeStatus ¶
type NodeStatus struct { Node NodeStatusNode `json:"node"` Org NodeStatusOrg `json:"org"` Defaults NodeStatusDefaults `json:"defaults"` }
NodeStatus is a set of information that represents the health, and identity of a node
type NodeStatusDefaults ¶
type NodeStatusDefaults struct {
Namespace string `json:"namespace"`
}
NodeStatusDefaults is information about core configuration th
type NodeStatusNode ¶
type NodeStatusNode struct { Name string `json:"name"` Registered bool `json:"registered"` ID *UUID `json:"id,omitempty"` }
NodeStatusNode is the information about the local node, returned in the node status
type NodeStatusOrg ¶
type NodeStatusOrg struct { Name string `json:"name"` Registered bool `json:"registered"` Identity string `json:"identity,omitempty"` ID *UUID `json:"id,omitempty"` }
NodeStatusOrg is the information about the node owning org, returned in the node status
type Nonce ¶
type Nonce struct { Context *Bytes32 `json:"hash"` Nonce int64 `json:"nonce"` Group *Bytes32 `json:"group,omitempty"` Topic string `json:"topic"` }
Nonce is this local node's state record for the context of a group+topic combination. It records the node's latest allocated sequence number for the context. A context is a hash of a GroupID and a topic, concattenated together
type Offset ¶
type Offset struct { Type OffsetType `json:"type" ffenum:"offsettype"` Name string `json:"name"` Current int64 `json:"current,omitempty"` RowID int64 `json:"-"` }
Offset is a simple stored data structure that records a sequence position within another collection
type OffsetType ¶
type OffsetType = FFEnum
var ( // OffsetTypeBatch is an offset stored by the batch manager on the messages table OffsetTypeBatch OffsetType = ffEnum("offsettype", "batch") // OffsetTypeAggregator is an offset stored by the aggregator on the events table OffsetTypeAggregator OffsetType = ffEnum("offsettype", "aggregator") // OffsetTypeSubscription is an offeset stored by a dispatcher on the events table OffsetTypeSubscription OffsetType = ffEnum("offsettype", "subscription") )
type OpStatus ¶
type OpStatus string
OpStatus is the current status of an operation
const ( // OpStatusPending indicates the operation has been submitted, but is not yet confirmed as successful or failed OpStatusPending OpStatus = "Pending" // OpStatusSucceeded the infrastructure runtime has returned success for the operation. OpStatusSucceeded OpStatus = "Succeeded" // OpStatusFailed happens when an error is reported by the infrastructure runtime OpStatusFailed OpStatus = "Failed" )
type OpType ¶
type OpType = FFEnum
OpType describes mechanical steps in the process that have to be performed, might be asynchronous, and have results in the back-end systems that might need to be correlated with messages by operators.
var ( // OpTypeBlockchainBatchPin is a blockchain transaction to pin a batch OpTypeBlockchainBatchPin OpType = ffEnum("optype", "blockchain_batch_pin") // OpTypePublicStorageBatchBroadcast is a public storage operation to store broadcast data OpTypePublicStorageBatchBroadcast OpType = ffEnum("optype", "publicstorage_batch_broadcast") // OpTypeDataExchangeBatchSend is a private send OpTypeDataExchangeBatchSend OpType = ffEnum("optype", "dataexchange_batch_send") // OpTypeDataExchangeBlobSend is a private send OpTypeDataExchangeBlobSend OpType = ffEnum("optype", "dataexchange_blob_send") // OpTypeTokenCreatePool is a token pool creation OpTypeTokenCreatePool OpType = ffEnum("optype", "token_create_pool") // OpTypeTokenAnnouncePool is a broadcast of token pool info OpTypeTokenAnnouncePool OpType = ffEnum("optype", "token_announce_pool") // OpTypeTokenTransfer is a token transfer OpTypeTokenTransfer OpType = ffEnum("optype", "token_transfer") )
type Operation ¶
type Operation struct { ID *UUID `json:"id"` Namespace string `json:"namespace"` Transaction *UUID `json:"tx"` Type OpType `json:"type" ffenum:"optype"` Member string `json:"member,omitempty"` Status OpStatus `json:"status"` Error string `json:"error,omitempty"` Plugin string `json:"plugin"` BackendID string `json:"backendId"` Input JSONObject `json:"input,omitempty"` Output JSONObject `json:"output,omitempty"` Created *FFTime `json:"created,omitempty"` Updated *FFTime `json:"updated,omitempty"` }
Operation is a description of an action performed as part of a transaction submitted by this node
type Organization ¶
type Organization struct { ID *UUID `json:"id"` Message *UUID `json:"message,omitempty"` Parent string `json:"parent,omitempty"` Identity string `json:"identity,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Profile JSONObject `json:"profile,omitempty"` Created *FFTime `json:"created,omitempty"` }
Organization is a top-level identity in the network
func (*Organization) GetDID ¶
func (org *Organization) GetDID() string
func (*Organization) SetBroadcastMessage ¶
func (org *Organization) SetBroadcastMessage(msgID *UUID)
func (*Organization) Topic ¶
func (org *Organization) Topic() string
type Pin ¶
type Pin struct { Sequence int64 `json:"sequence,omitempty"` Masked bool `json:"masked,omitempty"` Hash *Bytes32 `json:"hash,omitempty"` Batch *UUID `json:"batch,omitempty"` Index int64 `json:"index,omitempty"` Dispatched bool `json:"dispatched,omitempty"` Created *FFTime `json:"created,omitempty"` }
Pin represents a ledger-pinning event that has been detected from the blockchain, in the sequence that it was detected.
A batch contains many messages, and each of those messages can be on a different topic (or topics) All messages on the same topic must be processed in the order that the batch pinning events arrive from the blockchain.
As we need to correlate the on-chain events, with off-chain data that might arrive at a different time (or never), we "park" all pinned sequences first, then only complete them (and generate the associated events) once all the data has been assembled for all messages on that sequence, within that batch.
We might park the pin first (from the blockchain), or park the batch first (if it arrived first off-chain). There's a third part as well that can block a message, which is large blob data moving separately to the batch. If we get the private message, then the batch, before receiving the blob data - we have to upgrade a batch-park, to a pin-park. This is because the sequence must be in the order the pins arrive.
func (*Pin) LocalSequence ¶
type SortableBool ¶
type SortableBool bool
SortableBool is a boolean, which is stored as a SMALLINT in databases where sorting/indexing by a BOOLEAN type is not consistently supported. TRUE>FALSE
func (*SortableBool) Scan ¶
func (sb *SortableBool) Scan(src interface{}) error
type SubOptsFirstEvent ¶
type SubOptsFirstEvent string
SubOptsFirstEvent picks the first event that should be dispatched on the subscription, and can be a string containing an exact sequence as well as one of the enum values
const ( // SubOptsFirstEventOldest indicates all events should be dispatched to the subscription SubOptsFirstEventOldest SubOptsFirstEvent = "oldest" // SubOptsFirstEventNewest indicates only newly received events should be dispatched to the subscription SubOptsFirstEventNewest SubOptsFirstEvent = "newest" )
type Subscription ¶
type Subscription struct { SubscriptionRef Transport string `json:"transport"` Filter SubscriptionFilter `json:"filter"` Options SubscriptionOptions `json:"options"` Ephemeral bool `json:"ephemeral,omitempty"` Created *FFTime `json:"created"` Updated *FFTime `json:"updated"` }
Subscription is a binding between the stream of events within a namespace, and an event interface - such as an application listening on websockets
type SubscriptionCoreOptions ¶
type SubscriptionCoreOptions struct { FirstEvent *SubOptsFirstEvent `json:"firstEvent,omitempty"` ReadAhead *uint16 `json:"readAhead,omitempty"` WithData *bool `json:"withData,omitempty"` }
SubscriptionCoreOptions are the core options that apply across all transports
type SubscriptionFilter ¶
type SubscriptionFilter struct { Events string `json:"events,omitempty"` Topics string `json:"topics,omitempty"` Tag string `json:"tag,omitempty"` Group string `json:"group,omitempty"` Author string `json:"author,omitempty"` }
SubscriptionFilter contains regular expressions to match against events. All must match for an event to be dispatched to a subscription
type SubscriptionOptions ¶
type SubscriptionOptions struct { SubscriptionCoreOptions // Ephemeral subscriptions only can add this option to enable change events ChangeEvents bool `json:"-"` // contains filtered or unexported fields }
SubscriptionOptions cutomize the behavior of subscriptions
func (SubscriptionOptions) MarshalJSON ¶
func (so SubscriptionOptions) MarshalJSON() ([]byte, error)
func (*SubscriptionOptions) Scan ¶
func (so *SubscriptionOptions) Scan(src interface{}) error
Scan implements sql.Scanner
func (*SubscriptionOptions) TransportOptions ¶
func (so *SubscriptionOptions) TransportOptions() JSONObject
func (*SubscriptionOptions) UnmarshalJSON ¶
func (so *SubscriptionOptions) UnmarshalJSON(b []byte) error
type SubscriptionRef ¶
type SubscriptionRef struct { ID *UUID `json:"id"` Namespace string `json:"namespace"` Name string `json:"name"` }
SubscriptionRef are the fields that can be used to refer to a subscription
type SystemTag ¶
type SystemTag string
const ( // SystemTagDefineDatatype is the topic for messages that broadcast data definitions SystemTagDefineDatatype SystemTag = "ff_define_datatype" // SystemTagDefineNamespace is the topic for messages that broadcast namespace definitions SystemTagDefineNamespace SystemTag = "ff_define_namespace" // SystemTagDefineOrganization is the topic for messages that broadcast organization definitions SystemTagDefineOrganization SystemTag = "ff_define_organization" // SystemTagDefineNode is the topic for messages that broadcast node definitions SystemTagDefineNode SystemTag = "ff_define_node" // SystemTagDefineGroup is the topic for messages that send the definition of a group, to all parties in that group SystemTagDefineGroup SystemTag = "ff_define_group" // SystemTagDefinePool is the topic for messages that broadcast data definitions SystemTagDefinePool SystemTag = "ff_define_pool" )
type TokenAccount ¶
type TokenAccount struct { PoolProtocolID string `json:"poolProtocolId,omitempty"` TokenIndex string `json:"tokenIndex,omitempty"` Identity string `json:"identity,omitempty"` Balance BigInt `json:"balance"` }
func (*TokenAccount) Identifier ¶
func (t *TokenAccount) Identifier() string
type TokenBalanceChange ¶
type TokenPool ¶
type TokenPool struct { ID *UUID `json:"id,omitempty"` Type TokenType `json:"type" ffenum:"tokentype"` Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` ProtocolID string `json:"protocolId,omitempty"` Key string `json:"key,omitempty"` Symbol string `json:"symbol,omitempty"` Connector string `json:"connector,omitempty"` Message *UUID `json:"message,omitempty"` Created *FFTime `json:"created,omitempty"` Config JSONObject `json:"config,omitempty"` TX TransactionRef `json:"tx,omitempty"` }
func (*TokenPool) SetBroadcastMessage ¶
type TokenPoolAnnouncement ¶
type TokenTransfer ¶
type TokenTransfer struct { Type TokenTransferType `json:"type" ffenum:"tokentransfertype"` LocalID *UUID `json:"localId,omitempty"` PoolProtocolID string `json:"poolProtocolId,omitempty"` TokenIndex string `json:"tokenIndex,omitempty"` Key string `json:"key,omitempty"` From string `json:"from,omitempty"` To string `json:"to,omitempty"` Amount BigInt `json:"amount"` ProtocolID string `json:"protocolId,omitempty"` MessageHash *Bytes32 `json:"messageHash,omitempty"` Created *FFTime `json:"created,omitempty"` TX TransactionRef `json:"tx,omitempty"` }
type TokenTransferInput ¶ added in v0.10.1
type TokenTransferInput struct { TokenTransfer Message *MessageInOut `json:"message,omitempty"` }
type TokenTransferType ¶
type TokenTransferType = FFEnum
type Transaction ¶
type Transaction struct { ID *UUID `json:"id,omitempty"` Hash *Bytes32 `json:"hash"` Subject TransactionSubject `json:"subject"` Created *FFTime `json:"created"` Status OpStatus `json:"status"` ProtocolID string `json:"protocolId,omitempty"` Info JSONObject `json:"info,omitempty"` }
Transaction represents (blockchain) transactions that were submitted by this node, with the correlation information to look them up on the underlying ledger technology
type TransactionRef ¶
type TransactionRef struct { Type TransactionType `json:"type"` ID *UUID `json:"id,omitempty"` }
TransactionRef refers to a transaction, in other types
type TransactionSubject ¶
type TransactionSubject struct { Signer string `json:"signer"` // on-chain signing identity Namespace string `json:"namespace,omitempty"` Type TransactionType `json:"type" ffenum:"txtype"` Reference *UUID `json:"reference,omitempty"` }
TransactionSubject is the hashable reason for the transaction was performed
func (*TransactionSubject) Hash ¶
func (t *TransactionSubject) Hash() *Bytes32
type TransactionType ¶
type TransactionType = FFEnum
var ( // TransactionTypeNone indicates no transaction should be used for this message/batch TransactionTypeNone TransactionType = ffEnum("txtype", "none") // TransactionTypeBatchPin represents a pinning transaction, that verifies the originator of the data, and sequences the event deterministically between parties TransactionTypeBatchPin TransactionType = ffEnum("txtype", "batch_pin") // TransactionTypeTokenPool represents a token pool creation TransactionTypeTokenPool TransactionType = ffEnum("txtype", "token_pool") // TransactionTypeTokenTransfer represents a token transfer TransactionTypeTokenTransfer TransactionType = ffEnum("txtype", "token_transfer") )
type TransportPayloadType ¶
type TransportPayloadType = FFEnum
var ( TransportPayloadTypeMessage TransportPayloadType = ffEnum("transportpayload", "message") TransportPayloadTypeBatch TransportPayloadType = ffEnum("transportpayload", "batch") )
type TransportWrapper ¶
type TransportWrapper struct { Type TransportPayloadType `json:"type" ffenum:"transportpayload"` Message *Message `json:"message,omitempty"` Data []*Data `json:"data,omitempty"` Batch *Batch `json:"batch,omitempty"` Group *Group `json:"group,omitempty"` }
TransportWrapper wraps paylaods over data exchange transfers, for easy deserialization at target
type UUID ¶
UUID is a wrapper on a UUID implementation, ensuring Value handles nil
func MustParseUUID ¶
func (UUID) MarshalBinary ¶
func (UUID) MarshalText ¶
func (*UUID) UnmarshalBinary ¶
func (*UUID) UnmarshalText ¶
type ValidatorType ¶
type ValidatorType = FFEnum
var ( // ValidatorTypeJSON is the validator type for JSON Schema validation ValidatorTypeJSON ValidatorType = ffEnum("validatortype", "json") // ValidatorTypeNone explicitly disables validation, even when a datatype is set. Allowing categorization of datatype without validation. ValidatorTypeNone ValidatorType = ffEnum("validatortype", "none") // ValidatorTypeSystemDefinition is the validator type for system definitions ValidatorTypeSystemDefinition ValidatorType = ffEnum("validatortype", "definition") )
type WSChangeNotification ¶
type WSChangeNotification struct { WSClientActionBase ChangeEvent *ChangeEvent `json:"change"` }
WSChangeNotification is a special notification type for a change event, that does *not* require an ack
type WSClientActionAckPayload ¶
type WSClientActionAckPayload struct { WSClientActionBase ID *UUID `json:"id,omitempty"` Subscription *SubscriptionRef `json:"subscription,omitempty"` }
WSClientActionAckPayload acknowldges a received event (not applicable in AutoAck mode)
type WSClientActionBase ¶
type WSClientActionBase struct {
Type WSClientPayloadType `json:"type,omitempty"`
}
WSClientActionBase is the base fields of all client actions sent on the websocket
type WSClientActionStartPayload ¶
type WSClientActionStartPayload struct { WSClientActionBase AutoAck *bool `json:"autoack"` Namespace string `json:"namespace"` Name string `json:"name"` Ephemeral bool `json:"ephemeral"` Filter SubscriptionFilter `json:"filter"` Options SubscriptionOptions `json:"options"` ChangeEvents string `json:"changeEvents,omitempty"` }
WSClientActionStartPayload starts a subscription on this socket - either an existing one, or creating an ephemeral one
type WSClientPayloadType ¶
type WSClientPayloadType = FFEnum
WSClientPayloadType actions go from client->server
var ( // WSClientActionStart is a request to the server to start delivering messages to the client WSClientActionStart WSClientPayloadType = ffEnum("wstype", "start") // WSClientActionAck acknowledges an event that was delivered, allowing further messages to be sent WSClientActionAck WSClientPayloadType = ffEnum("wstype", "ack") // WSProtocolErrorEventType is a special event "type" field for server to send the client, if it performs a ProtocolError WSProtocolErrorEventType WSClientPayloadType = ffEnum("wstype", "protocol_error") // WSClientActionChangeNotifcation a special event type that is a local database change event, and never requires an ack WSClientActionChangeNotifcation WSClientPayloadType = ffEnum("wstype", "change_notification") )
type WSProtocolErrorPayload ¶
type WSProtocolErrorPayload struct { Type WSClientPayloadType `json:"type" ffenum:"wstype"` Error string `json:"error"` }
WSProtocolErrorPayload is sent to the client by the server in the case of a protocol error
Source Files ¶
- batch.go
- bigint.go
- blob.go
- byteable.go
- bytyetypes.go
- change_event.go
- config.go
- constants.go
- data.go
- datatype.go
- definition.go
- emptyinput.go
- enum.go
- event.go
- group.go
- identity.go
- idutils.go
- jsondata.go
- locally_sequenced.go
- message.go
- multipart.go
- namearray.go
- namespace.go
- nexthash.go
- node.go
- node_status.go
- nonce.go
- offset.go
- operation.go
- organization.go
- pin.go
- resterror.go
- sizeutils.go
- sortable_bool.go
- subscription.go
- timeutils.go
- tokenaccount.go
- tokenpool.go
- tokentransfer.go
- transaction.go
- transport_wrapper.go
- uuid.go
- validations.go
- websocket_actions.go