store

package
v0.0.0-...-b2761b6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2014 License: GPL-3.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package store takes care of storing pending notifications.

Index

Constants

View Source
const SystemInternalChannelId = InternalChannelId("0")

Variables

View Source
var ErrExpected128BitsHexRepr = errors.New("expected 128 bits hex repr")
View Source
var ErrFull = errors.New("channel is full")
View Source
var ErrUnknownChannel = errors.New("unknown channel name")

Functions

func InternalChannelIdToHex

func InternalChannelIdToHex(chanId InternalChannelId) string

Types

type InMemoryPendingStore

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

InMemoryPendingStore is a basic in-memory pending notification store.

func NewInMemoryPendingStore

func NewInMemoryPendingStore() *InMemoryPendingStore

NewInMemoryPendingStore returns a new InMemoryStore.

func (*InMemoryPendingStore) AppendToChannel

func (sto *InMemoryPendingStore) AppendToChannel(chanId InternalChannelId, notification json.RawMessage) error

func (*InMemoryPendingStore) GetChannelSnapshot

func (sto *InMemoryPendingStore) GetChannelSnapshot(chanId InternalChannelId) (int64, []json.RawMessage, error)

func (*InMemoryPendingStore) GetInternalChannelId

func (sto *InMemoryPendingStore) GetInternalChannelId(name string) (InternalChannelId, error)

type InternalChannelId

type InternalChannelId string

func HexToInternalChannelId

func HexToInternalChannelId(hexRepr string) (InternalChannelId, error)

type PendingStore

type PendingStore interface {
	// GetInternalChannelId returns the internal store id for a channel
	// given the name.
	GetInternalChannelId(name string) (InternalChannelId, error)
	// AppendToChannel appends a notification to the channel. xxx expiration
	AppendToChannel(chanId InternalChannelId, notification json.RawMessage) error
	// GetChannelSnapshot gets all the current notifications and
	// current top level in the channel.
	GetChannelSnapshot(chanId InternalChannelId) (topLevel int64, payloads []json.RawMessage, err error)
}

PendingStore let store notifications into channels.

Jump to

Keyboard shortcuts

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