streams

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package streams is a client for DynamoDB Streams within Dynago.

This provides access to the DynamoDB streams API with all the conveniences that one would expect from using Dynago: document unmarshaling to go types, clean API's and a way to write applications simply.

Despite what is said above, this package is still a low-level interface to the DynamoDB streams API calls, which is a bit more clumsy to use than the higher level interface, which is available at http://godoc.org/github.com/crast/dynatools/streamer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the low-level interface to the streams API.

Here, all the individual Streams API requests are available. Because this is a low-level client package, the main aim is to provide mappings for the core API calls needed to implement streaming.

For more information on how the API's interact, check out: http://docs.aws.amazon.com/dynamodbstreams/latest/APIReference/Welcome.html

func NewClient

func NewClient(config *Config) *Client

NewClient returns a new streams low-level client from config.

func (*Client) DescribeStream

func (s *Client) DescribeStream(request *DescribeStreamRequest) (dest *DescribeStreamResponse, err error)

DescribeStream gets metadata about a stream and information about its shards.

func (*Client) GetRecords

func (s *Client) GetRecords(req *GetRecordsRequest) (result *GetRecordsResponse, err error)

GetRecords will get the next set of records inside a DynamoDB streams shard.

An empty set of records does not mean the stream is complete; only the absence of an iterator signals completion of a stream shard (such as the shard is now closed for new data)

func (*Client) GetShardIterator

func (s *Client) GetShardIterator(req *GetIteratorRequest) (dest *GetIteratorResult, err error)

GetShardIterator is required to get a valid iterator before you begin streaming.

type Config

type Config struct {
	// Must implement MakeRequestUnmarshal. The easiest thing to use in this
	// case is an instance of dynago.AwsExecutor or the like.
	Requester MakeRequester
}

Config is configuration for a streams client.

type DescribeStreamRequest

type DescribeStreamRequest struct {
	ExclusiveStartShardId string `json:",omitempty"`
	Limit                 uint   `json:",omitempty"`
	StreamArn             string
}

type DescribeStreamResponse

type DescribeStreamResponse struct {
	StreamDescription StreamDescription
}

type GetIteratorRequest

type GetIteratorRequest struct {
	StreamArn         string
	ShardId           string
	ShardIteratorType IteratorType
	SequenceNumber    string `json:",omitempty"`
}

type GetIteratorResult

type GetIteratorResult struct {
	ShardIterator string
}

type GetRecordsRequest

type GetRecordsRequest struct {
	ShardIterator string
	Limit         uint `json:",omitempty"`
}

type GetRecordsResponse

type GetRecordsResponse struct {
	NextShardIterator string
	Records           []Record
}

type IteratorType

type IteratorType string

IteratorType controls where to start in a stream.

const (
	IteratorAtSequence    IteratorType = "AT_SEQUENCE_NUMBER"
	IteratorAfterSequence IteratorType = "AFTER_SEQUENCE_NUMBER"
	IteratorTrimHorizon   IteratorType = "TRIM_HORIZON"
	IteratorLatest        IteratorType = "LATEST"
)

type MakeRequester

type MakeRequester interface {
	MakeRequestUnmarshal(method string, document interface{}, dest interface{}) (err error)
}

MakeRequester is Equivalent to the dynago version

type Record

type Record struct {
	StreamRecord `json:"dynamodb"`
	AwsRegion    string
	EventId      string
	EventName    string
	EventSource  string
	EventVersion string
}

Record is a description of a unique event within a stream.

type SequenceNumberRange

type SequenceNumberRange struct {
	EndingSequenceNumber   string
	StartingSequenceNumber string
}

SequenceNumberRange is information about sequence numbers in a stream

type Shard

type Shard struct {
	ParentShardId       string
	SequenceNumberRange SequenceNumberRange
	ShardId             string
}

Shard describes one of the shards of a stream

type Stream

type Stream struct {
	StreamArn   string
	StreamLabel string
	TableName   string
}

Stream is the compact representation of a stream.

type StreamDescription

type StreamDescription struct {
	Stream
	KeySchema      []schema.KeySchema
	Shards         []Shard
	StreamStatus   string
	StreamViewType string

	CreationRequestDateTime float64
	LastEvaluatedShardId    string
}

StreamDescription is the main response value from DescribeStream

type StreamRecord

type StreamRecord struct {
	Keys           dynago.Document
	OldImage       dynago.Document
	NewImage       dynago.Document
	SequenceNumber string
	SizeBytes      uint64
	StreamViewType string
}

StreamRecord is a description of a single data modification that was performed on an item in a DynamoDB table.

Jump to

Keyboard shortcuts

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