db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbConnection

type DbConnection struct {
	Server     string
	Username   string
	Password   string
	Bucket     string
	NumRetries int
	Timeout    time.Duration
	// contains filtered or unexported fields
}

func (*DbConnection) GetHistory

func (db *DbConnection) GetHistory(deviceId string) ([]Event, error)

func (*DbConnection) GetTombstone

func (db *DbConnection) GetTombstone(deviceId string) (map[string]Event, error)

func (*DbConnection) Initialize

func (db *DbConnection) Initialize() error

func (*DbConnection) InsertEvent

func (db *DbConnection) InsertEvent(deviceId string, event Event, tombstoneMapKey string) error

func (*DbConnection) RemoveAll

func (db *DbConnection) RemoveAll() error

func (*DbConnection) RemoveHistory

func (db *DbConnection) RemoveHistory(deviceId string, numToRemove int) error

type Event

type Event struct {
	// the id for the event
	//
	// required: true
	Id string `json:"id"`

	// the time this event was found
	//
	// required: true
	Time int64 `json:"time"`

	// the source of this event
	//
	// required: true
	Source string `json:"src"`

	// the destination of this event
	//
	// required: true
	Destination string `json:"dest"`

	// the partners related to this device
	//
	// required: true
	PartnerIDs []string `json:"partner_ids"`

	// the transaction id for this event
	//
	// required: true
	TransactionUUID string `json:"transaction_uuid,omitempty"`

	// payload
	//
	// required: false
	Payload []byte `json:"payload,omitempty"`

	// other metadata and details related to this state
	//
	// required: true
	Details map[string]interface{} `json:"details"`
}

Event represents the event information in the database

swagger:model Event

type Interface

type Interface interface {
	Initialize() error
	GetHistory(deviceId string) ([]Event, error)
	GetTombstone(deviceId string) (map[string]Event, error)
	RemoveHistory(deviceId string, numToRemove int) error
	InsertEvent(deviceId string, event Event, tombstoneKey string) error
	RemoveAll() error
}

type Tombstone

type Tombstone struct {
	Events map[string]Event `json:"events"`
}

Tombstone hold the map of the last of certain events that are saved so that they are not deleted

swagger:model Tombstone

Jump to

Keyboard shortcuts

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