Documentation
¶
Overview ¶
Package fossilizer defines types to implement a fossilizer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunExporter ¶ added in v0.3.1
func RunExporter(ctx context.Context, f Adapter, e EventExporter)
RunExporter connects the given exporter to the given fossilizer. RunExporter should run inside a go routine and will return when the context is cancelled.
Types ¶
type Adapter ¶
type Adapter interface {
// Returns arbitrary information about the adapter.
GetInfo(context.Context) (interface{}, error)
// Adds a channel that receives events from the fossilizer
AddFossilizerEventChan(chan *Event)
// Requests data to be fossilized.
// Meta is arbitrary data that will be forwarded to the websocket.
Fossilize(ctx context.Context, data []byte, meta []byte) error
}
Adapter must be implemented by a fossilier.
type Event ¶ added in v0.2.0
type Event struct {
EventType EventType
Data interface{}
}
Event is the object fossilizers send to notify of important events.
type EventExporter ¶ added in v0.3.1
type EventExporter interface {
// Push an event to the exporter.
Push(context.Context, *Event) error
}
EventExporter can be used to export events generated by a fossilizer.
type EventType ¶ added in v0.2.0
type EventType string
EventType lets you know the kind of event received. A client should ignore events it doesn't care about or doesn't understand.
const ( // DidFossilize is sent when a piece of data was successfully fossilized. DidFossilize EventType = "DidFossilize" )
type Fossil ¶ added in v0.3.1
type Fossil struct {
// The data that was fossilized.
Data []byte `json:"data"`
// The metadata associated with the fossilized data.
Meta []byte `json:"meta"`
}
Fossil that will be fossilized.
type FossilsQueue ¶ added in v0.3.1
type FossilsQueue interface {
// Push a fossil to the queue.
Push(context.Context, *Fossil) error
// Pop fossils from the queue.
Pop(context.Context, int) ([]*Fossil, error)
}
FossilsQueue can be used by batch fossilizers to store data that's pending fossilization. StorageQueue implementations can use persistent storage (like cloud queues) to prevent loss of data in cloud micro-services architecture.
type Result ¶
type Result struct {
// Evidence created by the fossilizer.
Evidence chainscript.Evidence
// The fossilized data.
Fossil
}
Result is the type sent to the result channels.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fossilizerhttp is used to create an HTTP server from a fossilizer adapter.
|
Package fossilizerhttp is used to create an HTTP server from a fossilizer adapter. |
|
Package fossilizertesting defines helpers to test fossilizers.
|
Package fossilizertesting defines helpers to test fossilizers. |