api

package
v0.9.20 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockTypeTX                     = "tx"              // corresponds to blocks containing regular transactions
	BlockTypeConfig                 = "config"          // corresponds to blocks containing channel configurations and updates
	EventPayloadTypeBytes           = "bytes"           // default data type of the event payload, no special processing is done before returning to the subscribing client
	EventPayloadTypeString          = "string"          // event payload will be an UTF-8 encoded string
	EventPayloadTypeJSON            = "json"            // event payload will be a structured map with UTF-8 encoded string values
	EventPayloadTypeStringifiedJSON = "stringifiedJSON" // equivalent to "json" (deprecated)
)

Variables

This section is empty.

Functions

func GetKeyForEventClient added in v0.9.15

func GetKeyForEventClient(channelID string, chaincodeID string) string

Types

type EventEntry

type EventEntry struct {
	ChaincodeID      string      `json:"chaincodeId"`
	BlockNumber      uint64      `json:"blockNumber"`
	TransactionID    string      `json:"transactionId"`
	TransactionIndex int         `json:"transactionIndex"`
	EventIndex       int         `json:"eventIndex"`
	EventName        string      `json:"eventName"`
	Payload          interface{} `json:"payload"`
	Timestamp        int64       `json:"timestamp,omitempty"`
	SubID            string      `json:"subId"`
}

type SubscriptionInfo

type SubscriptionInfo struct {
	TimeSorted
	ID          string          `json:"id,omitempty"`
	ChannelID   string          `json:"channel,omitempty"`
	Path        string          `json:"path"`
	Summary     string          `json:"-"`      // System generated name for the subscription
	Name        string          `json:"name"`   // User provided name for the subscription, set to Summary if missing
	Stream      string          `json:"stream"` // the event stream this subscription is associated under
	Signer      string          `json:"signer"`
	FromBlock   string          `json:"fromBlock,omitempty"`
	Filter      persistedFilter `json:"filter"`
	PayloadType string          `json:"payloadType,omitempty"` // optional. data type of the payload bytes; "bytes", "string" or "stringifiedJSON/json". Default to "bytes"
}

SubscriptionInfo is the persisted data for the subscription

func (*SubscriptionInfo) GetID

func (info *SubscriptionInfo) GetID() string

GetID returns the ID (for sorting)

type TimeSortable

type TimeSortable interface {
	IsLessThan(TimeSortable, TimeSortable) bool
	GetISO8601() string
	GetID() string
}

TimeSortable interface can be implemented by embedding TimeSorted and adding getID

type TimeSorted

type TimeSorted struct {
	CreatedISO8601 string `json:"created"`
}

TimeSorted base structure for time sortable things

func (*TimeSorted) GetISO8601

func (i *TimeSorted) GetISO8601() string

GetISO8601 returns an ISO8601 string

func (*TimeSorted) IsLessThan

func (*TimeSorted) IsLessThan(i TimeSortable, j TimeSortable) bool

IsLessThan performs reverse sorting by age, then forward sorting by ID

Jump to

Keyboard shortcuts

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