db

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CFAuditEventsTable  = "cf_audit_events"
	ShipperCursorsTable = "shipper_cursors"

	DefaultInitTimeout  = 15 * time.Minute
	DefaultStoreTimeout = 10 * time.Minute
	DefaultQueryTimeout = 60 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventDB

type EventDB interface {
	Init() error

	StoreCFAuditEvents(events []cfclient.Event) error
	GetCFAuditEvents(filter RawEventFilter) ([]cfclient.Event, error)
	GetLatestCFEventTime() (*time.Time, error)
	GetCFEventCount() (int64, error)

	GetUnshippedCFAuditEventsForShipper(shipperName string) ([]cfclient.Event, error)
	UpdateShipperCursor(shipperName string, shipperTime string, shippedID string) error
}

type EventStore

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

func NewEventStore

func NewEventStore(ctx context.Context, db *sql.DB, logger lager.Logger) *EventStore

func (*EventStore) GetCFAuditEvents

func (s *EventStore) GetCFAuditEvents(filter RawEventFilter) ([]cfclient.Event, error)

func (*EventStore) GetCFEventCount

func (s *EventStore) GetCFEventCount() (int64, error)

func (*EventStore) GetLatestCFEventTime

func (s *EventStore) GetLatestCFEventTime() (*time.Time, error)

func (*EventStore) GetUnshippedCFAuditEventsForShipper

func (s *EventStore) GetUnshippedCFAuditEventsForShipper(shipperName string) ([]cfclient.Event, error)

func (*EventStore) Init

func (s *EventStore) Init() error

Init initialises the database tables and functions

func (*EventStore) StoreCFAuditEvents

func (s *EventStore) StoreCFAuditEvents(events []cfclient.Event) error

func (*EventStore) UpdateShipperCursor

func (s *EventStore) UpdateShipperCursor(shipperName string, shipperTime string, shippedID string) error

type RawEventFilter

type RawEventFilter struct {
	Reverse bool
	Limit   int
	Kind    string
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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