cothority: go.dedis.ch/cothority/eventlog Index | Files | Directories

package eventlog

import "go.dedis.ch/cothority/eventlog"

Index

Package Files

api.go buckets.go proto.go service.go

Variables

var ServiceName = "EventLog"

ServiceName is the service name for the EventLog service.

type Client Uses

type Client struct {
    ByzCoin *byzcoin.Client
    // The DarcID with "invoke:eventlog.log" permission on it.
    DarcID darc.ID
    // Signers are the Darc signers that will sign transactions sent with this client.
    Signers  []darc.Signer
    Instance byzcoin.InstanceID
    // contains filtered or unexported fields
}

Client is a structure to communicate with the eventlog service

func NewClient Uses

func NewClient(ol *byzcoin.Client) *Client

NewClient creates a new client to talk to the eventlog service. Fields DarcID, Instance, and Signers must be filled in before use.

func (*Client) Close Uses

func (c *Client) Close() error

Close closes all the websocket connections.

func (*Client) Create Uses

func (c *Client) Create() error

Create creates a new event log. This method is synchronous: it will only return once the new eventlog has been committed into the ledger (or after a timeout). Upon non-error return, c.Instance will be correctly set.

func (*Client) GetEvent Uses

func (c *Client) GetEvent(key []byte) (*Event, error)

GetEvent asks the service to retrieve an event.

func (*Client) Log Uses

func (c *Client) Log(ev ...Event) ([]LogID, error)

Log asks the service to log events. The client needs to wait for the log to be included for the next log to be accepted.

func (*Client) LogAndWait Uses

func (c *Client) LogAndWait(numInterval int, ev ...Event) ([]LogID, error)

LogAndWait sends a request to log the events and waits for N block intervals that the events are added to the ledger

func (*Client) RefreshSignerCounters Uses

func (c *Client) RefreshSignerCounters()

RefreshSignerCounters talks to the service to get the latest signer counters, the client should call this function if the internal counters become de-synchronised.

func (*Client) Search Uses

func (c *Client) Search(req *SearchRequest) (*SearchResponse, error)

Search executes a search on the filter in req. See the definition of type SearchRequest for additional details about how the filter is interpreted. The ID and Instance fields of the SearchRequest will be filled in from c.

func (*Client) StreamEvents Uses

func (c *Client) StreamEvents(handler StreamHandler) error

StreamEvents is a blocking call where it calls the handler on every new event until the connection is closed or the server stops.

func (*Client) StreamEventsFrom Uses

func (c *Client) StreamEventsFrom(handler StreamHandler, id []byte) error

StreamEventsFrom is a blocking call where it calls the handler on even new event from (inclusive) the given block ID until the connection is closed or the server stops.

type Event Uses

type Event struct {
    When    int64
    Topic   string
    Content string
}

Event is sent to create an event log. When should be set using the UnixNano() method in package time.

func NewEvent Uses

func NewEvent(topic, content string) Event

NewEvent returns a new event mapping with the current time as its timestamp and a random key.

type LogID Uses

type LogID []byte

A LogID is an opaque unique identifier useful to find a given log message later via GetEvent.

type SearchRequest Uses

type SearchRequest struct {
    Instance byzcoin.InstanceID
    ID       skipchain.SkipBlockID
    // Return events where Event.Topic == Topic, if Topic != "".
    Topic string
    // Return events where When is > From.
    From int64
    // Return events where When is <= To.
    To  int64
}

SearchRequest includes all the search parameters (AND of all provided search parameters). Topic == "" means "any topic". From == 0 means "from the first event", and To == 0 means "until now". From and To should be set using the UnixNano() method in package time.

type SearchResponse Uses

type SearchResponse struct {
    Events []Event
    // Events does not contain all the results. The caller should formulate
    // a new SearchRequest to continue searching, for instance by setting
    // From to the time of the last received event.
    Truncated bool
}

SearchResponse is the reply to LogRequest.

type Service Uses

type Service struct {
    *onet.ServiceProcessor
    // contains filtered or unexported fields
}

Service is the EventLog service.

func (*Service) Search Uses

func (s *Service) Search(req *SearchRequest) (*SearchResponse, error)

Search will search the event log for matching entries.

type StreamHandler Uses

type StreamHandler func(event Event, blockID []byte, err error)

StreamHandler is the signature of the handler used when streaming events.

Directories

PathSynopsis
el

Package eventlog imports 13 packages (graph). Updated 2020-02-18. Refresh now. Tools for package owners.