Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Journal ¶
type Journal interface { // Topic returns a Writer that records events for a topic. Topic(topic string) Writer }
Journal defines an interface for creating Journals with a topic.
func NewInMemoryJournal ¶
NewInMemoryJournal returns a journal backed by an in-memory map.
func NewZapJournal ¶
NewZapJournal returns a Journal backed by a zap logger. ZapJournal writes entries as ndjson to file at `filepath`.
type MemoryJournal ¶
type MemoryJournal struct {
// contains filtered or unexported fields
}
MemoryJournal represents a journal held in memory.
func (*MemoryJournal) Topic ¶
func (mj *MemoryJournal) Topic(topic string) Writer
Topic returns a Writer with the provided `topic`.
type MemoryWriter ¶
type MemoryWriter struct {
// contains filtered or unexported fields
}
MemoryWriter writes journal entires in memory.
func (*MemoryWriter) Write ¶
func (mw *MemoryWriter) Write(event string, kvs ...interface{})
Write records an operation and its metadata to a Journal accepting variadic key-value pairs.
type NoopJournal ¶
type NoopJournal struct{}
NoopJournal implements the Journal interface and Noops for all operations.
func (*NoopJournal) Topic ¶
func (nj *NoopJournal) Topic(topic string) Writer
Topic returns a NoopWriter.
type NoopWriter ¶
type NoopWriter struct{}
NoopWriter implements the Writer interface and Noops for all operations.
func (*NoopWriter) Write ¶
func (nw *NoopWriter) Write(event string, kvs ...interface{})
Write Noops for all operations.
type Writer ¶
type Writer interface { // Write records an operation and its metadata to a Journal accepting variadic key-value // pairs. Write(event string, kvs ...interface{}) }
Writer defines an interface for recording events and their metadata
type ZapJournal ¶
type ZapJournal struct {
// contains filtered or unexported fields
}
ZapJournal implemented the Journal interface.
func (*ZapJournal) Topic ¶
func (zj *ZapJournal) Topic(topic string) Writer
Topic returns a Writer that records events for a topic.