dydb

package
v0.0.0-...-4c91ef0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package dydb implements a diviner.Database on top of dynamodb and the AWS cloudwatch logs storage. Database instances may be safely shared between multiple users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

A DB represents a session to a DynamoDB table; it implements diviner.Database.

func New

func New(sess *session.Session, table string) *DB

New creates a new DB instance from the provided session and table name.

func (*DB) AppendRunMetrics

func (d *DB) AppendRunMetrics(ctx context.Context, study string, seq uint64, metrics diviner.Metrics) error

AppendRunMetrics reports new run metrics for the run named by the provided study and sequence number.

func (*DB) CreateStudyIfNotExist

func (d *DB) CreateStudyIfNotExist(ctx context.Context, study diviner.Study) (created bool, err error)

CreateStudyIfNotExist creates a new study if it does not already exist. Existing studies are not updated.

func (*DB) CreateTable

func (d *DB) CreateTable(ctx context.Context) error

CreateTable creates the dynamoDB table named by this DB instance together with the required indices for operating in Diviner. The billing mode is set to PAY_PER_REQUEST.

func (*DB) InsertRun

func (d *DB) InsertRun(ctx context.Context, run diviner.Run) (diviner.Run, error)

InsertRun inserts a new run into the provided study. The returned run is assigned a fresh sequence number and is returned with state Pending.

func (*DB) ListRuns

func (d *DB) ListRuns(ctx context.Context, study string, states diviner.RunState, since time.Time) (runs []diviner.Run, err error)

ListRuns returns all runs in the provided study matching the query states that have also been active since the provided time.

func (*DB) ListStudies

func (d *DB) ListStudies(ctx context.Context, prefix string, since time.Time) ([]diviner.Study, error)

ListStudies returns the set of studies in the database that have the provided prefix and have been active since the provided time.

func (*DB) Log

func (d *DB) Log(study string, seq uint64, since time.Time, follow bool) io.Reader

Log returns an io.Reader that reads log messages from the AWS CloudWatch Logs service.

func (*DB) Logger

func (d *DB) Logger(study string, seq uint64) io.WriteCloser

Logger returns a logger that writes log messages, line-for-line to the AWS CloudWatch Logs service.

func (*DB) LookupRun

func (d *DB) LookupRun(ctx context.Context, study string, seq uint64) (diviner.Run, error)

LookupRun retruns the run named by the provided study and sequence number.

func (*DB) LookupStudy

func (d *DB) LookupStudy(ctx context.Context, name string) (study diviner.Study, err error)

LookupStudy returns the study with the provided name.

func (*DB) NextSeq

func (d *DB) NextSeq(ctx context.Context, study string) (uint64, error)

NextSeq reserves the next run ID for the provided study.

func (*DB) UpdateRun

func (d *DB) UpdateRun(ctx context.Context, study string, seq uint64, state diviner.RunState, message string, runtime time.Duration, retry int) error

UpdateRun updates the state, message, and runtime of the run named by the provided study and sequence number.

Directories

Path Synopsis
Package dynamoattr provides functions for marshaling and unmarshaling Go values to and from DynamoDB items (map[string]*dynamodb.AttributeValue).
Package dynamoattr provides functions for marshaling and unmarshaling Go values to and from DynamoDB items (map[string]*dynamodb.AttributeValue).

Jump to

Keyboard shortcuts

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