dynamodb

package
v0.0.0-...-5da7e01 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPTimeout = time.Duration(10) * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTableParam

type CreateTableParam struct {
	Name string
	RCU  int64 // ReadCapacityUnits
	WCU  int64 // WriteCapacityUnits
}

CreateTableParam is parameter set of CreateTable.

type DynamoDB

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

DynamoDB provides a dynamodb client.

func New

func New() (*DynamoDB, error)

New creates a new DynamoDB.

func NewTestDynamoDB

func NewTestDynamoDB(mock *MockDynamoDBAPI) *DynamoDB

func (*DynamoDB) Client

func (d *DynamoDB) Client() godynamodbiface.DynamoDBAPI

Client returns the DynamoDB client.

func (*DynamoDB) CreateTable

func (d *DynamoDB) CreateTable(param *CreateTableParam) error

CreateTable creates a dynamodb table to store time series data. Skip creating table if the table already exists.

func (*DynamoDB) Fetch

func (d *DynamoDB) Fetch(name string, start, end time.Time) (model.SeriesMap, error)

Fetch fetches datapoints by name from start until end.

func (*DynamoDB) Ping

func (d *DynamoDB) Ping() error

Ping pings DynamoDB endpoint.

func (*DynamoDB) Put

func (d *DynamoDB) Put(name, slot, history string, itemEpoch int64, tv map[int64]float64) error

Put writes the datapoints into DynamoDB. It creates item if item doesn't exist and updates item if it exists.

type FakeReadWriter

type FakeReadWriter struct {
	ReadWriter
	FakeFetch func(name string, start, end time.Time) (model.SeriesMap, error)
}

FakeReadWriter is for stub testing

func (*FakeReadWriter) Fetch

func (s *FakeReadWriter) Fetch(name string, start, end time.Time) (model.SeriesMap, error)

type MockDynamoDBAPI

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

Mock of DynamoDBAPI interface

func NewMockDynamoDBAPI

func NewMockDynamoDBAPI(ctrl *gomock.Controller) *MockDynamoDBAPI

func (*MockDynamoDBAPI) BatchGetItem

func (*MockDynamoDBAPI) BatchGetItemPages

func (_m *MockDynamoDBAPI) BatchGetItemPages(_param0 *dynamodb.BatchGetItemInput, _param1 func(*dynamodb.BatchGetItemOutput, bool) bool) error

func (*MockDynamoDBAPI) BatchGetItemPagesWithContext

func (_m *MockDynamoDBAPI) BatchGetItemPagesWithContext(_param0 aws.Context, _param1 *dynamodb.BatchGetItemInput, _param2 func(*dynamodb.BatchGetItemOutput, bool) bool, _param3 ...request.Option) error

func (*MockDynamoDBAPI) BatchGetItemRequest

func (_m *MockDynamoDBAPI) BatchGetItemRequest(_param0 *dynamodb.BatchGetItemInput) (*request.Request, *dynamodb.BatchGetItemOutput)

func (*MockDynamoDBAPI) BatchGetItemWithContext

func (_m *MockDynamoDBAPI) BatchGetItemWithContext(_param0 aws.Context, _param1 *dynamodb.BatchGetItemInput, _param2 ...request.Option) (*dynamodb.BatchGetItemOutput, error)

func (*MockDynamoDBAPI) BatchWriteItem

func (*MockDynamoDBAPI) BatchWriteItemRequest

func (_m *MockDynamoDBAPI) BatchWriteItemRequest(_param0 *dynamodb.BatchWriteItemInput) (*request.Request, *dynamodb.BatchWriteItemOutput)

func (*MockDynamoDBAPI) BatchWriteItemWithContext

func (_m *MockDynamoDBAPI) BatchWriteItemWithContext(_param0 aws.Context, _param1 *dynamodb.BatchWriteItemInput, _param2 ...request.Option) (*dynamodb.BatchWriteItemOutput, error)

func (*MockDynamoDBAPI) CreateTable

func (*MockDynamoDBAPI) CreateTableRequest

func (_m *MockDynamoDBAPI) CreateTableRequest(_param0 *dynamodb.CreateTableInput) (*request.Request, *dynamodb.CreateTableOutput)

func (*MockDynamoDBAPI) CreateTableWithContext

func (_m *MockDynamoDBAPI) CreateTableWithContext(_param0 aws.Context, _param1 *dynamodb.CreateTableInput, _param2 ...request.Option) (*dynamodb.CreateTableOutput, error)

func (*MockDynamoDBAPI) DeleteItem

func (*MockDynamoDBAPI) DeleteItemRequest

func (_m *MockDynamoDBAPI) DeleteItemRequest(_param0 *dynamodb.DeleteItemInput) (*request.Request, *dynamodb.DeleteItemOutput)

func (*MockDynamoDBAPI) DeleteItemWithContext

func (_m *MockDynamoDBAPI) DeleteItemWithContext(_param0 aws.Context, _param1 *dynamodb.DeleteItemInput, _param2 ...request.Option) (*dynamodb.DeleteItemOutput, error)

func (*MockDynamoDBAPI) DeleteTable

func (*MockDynamoDBAPI) DeleteTableRequest

func (_m *MockDynamoDBAPI) DeleteTableRequest(_param0 *dynamodb.DeleteTableInput) (*request.Request, *dynamodb.DeleteTableOutput)

func (*MockDynamoDBAPI) DeleteTableWithContext

func (_m *MockDynamoDBAPI) DeleteTableWithContext(_param0 aws.Context, _param1 *dynamodb.DeleteTableInput, _param2 ...request.Option) (*dynamodb.DeleteTableOutput, error)

func (*MockDynamoDBAPI) DescribeLimits

func (*MockDynamoDBAPI) DescribeLimitsRequest

func (_m *MockDynamoDBAPI) DescribeLimitsRequest(_param0 *dynamodb.DescribeLimitsInput) (*request.Request, *dynamodb.DescribeLimitsOutput)

func (*MockDynamoDBAPI) DescribeLimitsWithContext

func (_m *MockDynamoDBAPI) DescribeLimitsWithContext(_param0 aws.Context, _param1 *dynamodb.DescribeLimitsInput, _param2 ...request.Option) (*dynamodb.DescribeLimitsOutput, error)

func (*MockDynamoDBAPI) DescribeTable

func (*MockDynamoDBAPI) DescribeTableRequest

func (_m *MockDynamoDBAPI) DescribeTableRequest(_param0 *dynamodb.DescribeTableInput) (*request.Request, *dynamodb.DescribeTableOutput)

func (*MockDynamoDBAPI) DescribeTableWithContext

func (_m *MockDynamoDBAPI) DescribeTableWithContext(_param0 aws.Context, _param1 *dynamodb.DescribeTableInput, _param2 ...request.Option) (*dynamodb.DescribeTableOutput, error)

func (*MockDynamoDBAPI) DescribeTimeToLive

func (*MockDynamoDBAPI) DescribeTimeToLiveRequest

func (*MockDynamoDBAPI) DescribeTimeToLiveWithContext

func (_m *MockDynamoDBAPI) DescribeTimeToLiveWithContext(_param0 aws.Context, _param1 *dynamodb.DescribeTimeToLiveInput, _param2 ...request.Option) (*dynamodb.DescribeTimeToLiveOutput, error)

func (*MockDynamoDBAPI) EXPECT

func (_m *MockDynamoDBAPI) EXPECT() *_MockDynamoDBAPIRecorder

func (*MockDynamoDBAPI) GetItem

func (*MockDynamoDBAPI) GetItemRequest

func (_m *MockDynamoDBAPI) GetItemRequest(_param0 *dynamodb.GetItemInput) (*request.Request, *dynamodb.GetItemOutput)

func (*MockDynamoDBAPI) GetItemWithContext

func (_m *MockDynamoDBAPI) GetItemWithContext(_param0 aws.Context, _param1 *dynamodb.GetItemInput, _param2 ...request.Option) (*dynamodb.GetItemOutput, error)

func (*MockDynamoDBAPI) ListTables

func (*MockDynamoDBAPI) ListTablesPages

func (_m *MockDynamoDBAPI) ListTablesPages(_param0 *dynamodb.ListTablesInput, _param1 func(*dynamodb.ListTablesOutput, bool) bool) error

func (*MockDynamoDBAPI) ListTablesPagesWithContext

func (_m *MockDynamoDBAPI) ListTablesPagesWithContext(_param0 aws.Context, _param1 *dynamodb.ListTablesInput, _param2 func(*dynamodb.ListTablesOutput, bool) bool, _param3 ...request.Option) error

func (*MockDynamoDBAPI) ListTablesRequest

func (_m *MockDynamoDBAPI) ListTablesRequest(_param0 *dynamodb.ListTablesInput) (*request.Request, *dynamodb.ListTablesOutput)

func (*MockDynamoDBAPI) ListTablesWithContext

func (_m *MockDynamoDBAPI) ListTablesWithContext(_param0 aws.Context, _param1 *dynamodb.ListTablesInput, _param2 ...request.Option) (*dynamodb.ListTablesOutput, error)

func (*MockDynamoDBAPI) ListTagsOfResource

func (*MockDynamoDBAPI) ListTagsOfResourceRequest

func (*MockDynamoDBAPI) ListTagsOfResourceWithContext

func (_m *MockDynamoDBAPI) ListTagsOfResourceWithContext(_param0 aws.Context, _param1 *dynamodb.ListTagsOfResourceInput, _param2 ...request.Option) (*dynamodb.ListTagsOfResourceOutput, error)

func (*MockDynamoDBAPI) PutItem

func (*MockDynamoDBAPI) PutItemRequest

func (_m *MockDynamoDBAPI) PutItemRequest(_param0 *dynamodb.PutItemInput) (*request.Request, *dynamodb.PutItemOutput)

func (*MockDynamoDBAPI) PutItemWithContext

func (_m *MockDynamoDBAPI) PutItemWithContext(_param0 aws.Context, _param1 *dynamodb.PutItemInput, _param2 ...request.Option) (*dynamodb.PutItemOutput, error)

func (*MockDynamoDBAPI) Query

func (_m *MockDynamoDBAPI) Query(_param0 *dynamodb.QueryInput) (*dynamodb.QueryOutput, error)

func (*MockDynamoDBAPI) QueryPages

func (_m *MockDynamoDBAPI) QueryPages(_param0 *dynamodb.QueryInput, _param1 func(*dynamodb.QueryOutput, bool) bool) error

func (*MockDynamoDBAPI) QueryPagesWithContext

func (_m *MockDynamoDBAPI) QueryPagesWithContext(_param0 aws.Context, _param1 *dynamodb.QueryInput, _param2 func(*dynamodb.QueryOutput, bool) bool, _param3 ...request.Option) error

func (*MockDynamoDBAPI) QueryRequest

func (_m *MockDynamoDBAPI) QueryRequest(_param0 *dynamodb.QueryInput) (*request.Request, *dynamodb.QueryOutput)

func (*MockDynamoDBAPI) QueryWithContext

func (_m *MockDynamoDBAPI) QueryWithContext(_param0 aws.Context, _param1 *dynamodb.QueryInput, _param2 ...request.Option) (*dynamodb.QueryOutput, error)

func (*MockDynamoDBAPI) Scan

func (_m *MockDynamoDBAPI) Scan(_param0 *dynamodb.ScanInput) (*dynamodb.ScanOutput, error)

func (*MockDynamoDBAPI) ScanPages

func (_m *MockDynamoDBAPI) ScanPages(_param0 *dynamodb.ScanInput, _param1 func(*dynamodb.ScanOutput, bool) bool) error

func (*MockDynamoDBAPI) ScanPagesWithContext

func (_m *MockDynamoDBAPI) ScanPagesWithContext(_param0 aws.Context, _param1 *dynamodb.ScanInput, _param2 func(*dynamodb.ScanOutput, bool) bool, _param3 ...request.Option) error

func (*MockDynamoDBAPI) ScanRequest

func (_m *MockDynamoDBAPI) ScanRequest(_param0 *dynamodb.ScanInput) (*request.Request, *dynamodb.ScanOutput)

func (*MockDynamoDBAPI) ScanWithContext

func (_m *MockDynamoDBAPI) ScanWithContext(_param0 aws.Context, _param1 *dynamodb.ScanInput, _param2 ...request.Option) (*dynamodb.ScanOutput, error)

func (*MockDynamoDBAPI) TagResource

func (*MockDynamoDBAPI) TagResourceRequest

func (_m *MockDynamoDBAPI) TagResourceRequest(_param0 *dynamodb.TagResourceInput) (*request.Request, *dynamodb.TagResourceOutput)

func (*MockDynamoDBAPI) TagResourceWithContext

func (_m *MockDynamoDBAPI) TagResourceWithContext(_param0 aws.Context, _param1 *dynamodb.TagResourceInput, _param2 ...request.Option) (*dynamodb.TagResourceOutput, error)

func (*MockDynamoDBAPI) UntagResource

func (*MockDynamoDBAPI) UntagResourceRequest

func (_m *MockDynamoDBAPI) UntagResourceRequest(_param0 *dynamodb.UntagResourceInput) (*request.Request, *dynamodb.UntagResourceOutput)

func (*MockDynamoDBAPI) UntagResourceWithContext

func (_m *MockDynamoDBAPI) UntagResourceWithContext(_param0 aws.Context, _param1 *dynamodb.UntagResourceInput, _param2 ...request.Option) (*dynamodb.UntagResourceOutput, error)

func (*MockDynamoDBAPI) UpdateItem

func (*MockDynamoDBAPI) UpdateItemRequest

func (_m *MockDynamoDBAPI) UpdateItemRequest(_param0 *dynamodb.UpdateItemInput) (*request.Request, *dynamodb.UpdateItemOutput)

func (*MockDynamoDBAPI) UpdateItemWithContext

func (_m *MockDynamoDBAPI) UpdateItemWithContext(_param0 aws.Context, _param1 *dynamodb.UpdateItemInput, _param2 ...request.Option) (*dynamodb.UpdateItemOutput, error)

func (*MockDynamoDBAPI) UpdateTable

func (*MockDynamoDBAPI) UpdateTableRequest

func (_m *MockDynamoDBAPI) UpdateTableRequest(_param0 *dynamodb.UpdateTableInput) (*request.Request, *dynamodb.UpdateTableOutput)

func (*MockDynamoDBAPI) UpdateTableWithContext

func (_m *MockDynamoDBAPI) UpdateTableWithContext(_param0 aws.Context, _param1 *dynamodb.UpdateTableInput, _param2 ...request.Option) (*dynamodb.UpdateTableOutput, error)

func (*MockDynamoDBAPI) UpdateTimeToLive

func (*MockDynamoDBAPI) UpdateTimeToLiveRequest

func (*MockDynamoDBAPI) UpdateTimeToLiveWithContext

func (_m *MockDynamoDBAPI) UpdateTimeToLiveWithContext(_param0 aws.Context, _param1 *dynamodb.UpdateTimeToLiveInput, _param2 ...request.Option) (*dynamodb.UpdateTimeToLiveOutput, error)

func (*MockDynamoDBAPI) WaitUntilTableExists

func (_m *MockDynamoDBAPI) WaitUntilTableExists(_param0 *dynamodb.DescribeTableInput) error

func (*MockDynamoDBAPI) WaitUntilTableExistsWithContext

func (_m *MockDynamoDBAPI) WaitUntilTableExistsWithContext(_param0 aws.Context, _param1 *dynamodb.DescribeTableInput, _param2 ...request.WaiterOption) error

func (*MockDynamoDBAPI) WaitUntilTableNotExists

func (_m *MockDynamoDBAPI) WaitUntilTableNotExists(_param0 *dynamodb.DescribeTableInput) error

func (*MockDynamoDBAPI) WaitUntilTableNotExistsWithContext

func (_m *MockDynamoDBAPI) WaitUntilTableNotExistsWithContext(_param0 aws.Context, _param1 *dynamodb.DescribeTableInput, _param2 ...request.WaiterOption) error

type ReadWriter

type ReadWriter interface {
	Ping() error
	Client() godynamodbiface.DynamoDBAPI
	CreateTable(*CreateTableParam) error
	Fetch(string, time.Time, time.Time) (model.SeriesMap, error)

	Put(string, string, string, int64, map[int64]float64) error
	// contains filtered or unexported methods
}

ReadWriter defines the interface for DynamoDB reader and writer.

Jump to

Keyboard shortcuts

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