datastore

package
v0.0.0-...-31bb6df Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

* Copyright 2020, Ulf Lilleengen * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).

* Copyright 2020, Ulf Lilleengen * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).

* Copyright 2019, Ulf Lilleengen * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).

* Copyright 2020, Ulf Lilleengen * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).

* Copyright 2019, Ulf Lilleengen * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).

Index

Constants

View Source
const METADATA_SZ int64 = int64(16)

Variables

This section is empty.

Functions

func Flusher

func Flusher(flushInterval time.Duration, ds Datastore)

func GarbageCollector

func GarbageCollector(gcInterval time.Duration, ds Datastore)

func NewFileDatastore

func NewFileDatastore(dataDir string, maxLogAge int64, maxLogSize int64) (*fileDatastore, error)

func OpenMapped

func OpenMapped(path string) (*mappedFile, error)

Types

type Datastore

type Datastore interface {
	Initialize() error
	CreateTopic(topic string) error
	InsertMessage(topic string, message *api.Message) error
	StreamMessages(topic string, offset int64, callback StreamingFunc) error
	// Read the number of events stored
	NumMessages(topic string) (int64, error)
	LastOffset(topic string) (int64, error)
	Flush() error
	GarbageCollect(topic string) error
	ListTopics() ([]string, error)
	Close()
}

type MemoryDatastore

type MemoryDatastore struct {
	// contains filtered or unexported fields
}

func NewMemoryDatastore

func NewMemoryDatastore() (*MemoryDatastore, error)

func (*MemoryDatastore) Close

func (m *MemoryDatastore) Close()

func (*MemoryDatastore) CreateTopic

func (m *MemoryDatastore) CreateTopic(topic string) error

func (*MemoryDatastore) Flush

func (m *MemoryDatastore) Flush() error

func (*MemoryDatastore) GarbageCollect

func (m *MemoryDatastore) GarbageCollect(topic string) error

func (*MemoryDatastore) Initialize

func (m *MemoryDatastore) Initialize() error

func (*MemoryDatastore) InsertMessage

func (m *MemoryDatastore) InsertMessage(topic string, message *api.Message) error

func (*MemoryDatastore) LastOffset

func (m *MemoryDatastore) LastOffset(topic string) (int64, error)

func (*MemoryDatastore) ListTopics

func (m *MemoryDatastore) ListTopics() ([]string, error)

func (*MemoryDatastore) NumMessages

func (m *MemoryDatastore) NumMessages(topic string) (int64, error)

func (*MemoryDatastore) StreamMessages

func (m *MemoryDatastore) StreamMessages(topic string, offset int64, callback StreamingFunc) error

type SqlDatastore

type SqlDatastore struct {
	// contains filtered or unexported fields
}

func NewSqliteDatastore

func NewSqliteDatastore(dataDir string, maxLogAge int64, maxLogSize int64) (*SqlDatastore, error)

func (SqlDatastore) Close

func (ds SqlDatastore) Close()

func (SqlDatastore) CreateTopic

func (ds SqlDatastore) CreateTopic(topic string) error

func (SqlDatastore) Flush

func (ds SqlDatastore) Flush() error

func (SqlDatastore) GarbageCollect

func (ds SqlDatastore) GarbageCollect(topic string) error

func (SqlDatastore) Initialize

func (ds SqlDatastore) Initialize() error

func (SqlDatastore) InsertMessage

func (ds SqlDatastore) InsertMessage(topic string, message *api.Message) error

func (SqlDatastore) LastOffset

func (ds SqlDatastore) LastOffset(topic string) (int64, error)

func (SqlDatastore) ListMessages

func (ds SqlDatastore) ListMessages(topic string, limit int64, offset int64, insertionTime int64) ([]*api.Message, error)

func (SqlDatastore) ListTopics

func (ds SqlDatastore) ListTopics() ([]string, error)

func (SqlDatastore) NumMessages

func (ds SqlDatastore) NumMessages(topic string) (int64, error)

func (SqlDatastore) StreamMessages

func (ds SqlDatastore) StreamMessages(topic string, offset int64, callback StreamingFunc) error

type StreamingFunc

type StreamingFunc func(*api.Message) error

Jump to

Keyboard shortcuts

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