awsdynamodb

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InternalServerError                    = "InternalServerError"
	LimitExceededException                 = "LimitExceededException"
	TableInUseException                    = "TableInUseException"
	ResourceNotFoundException              = "ResourceNotFoundException"
	TableNotFoundException                 = "TableNotFoundException"
	ConditionalCheckFailedException        = "ConditionalCheckFailedException"
	ProvisionedThroughputExceededException = "ProvisionedThroughputExceededException"
)

DynamoDB related const

View Source
const (
	RoleWorker  = "worker"
	RoleManager = "manager"
)

DynamoDB related const

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoDB

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

DynamoDB implements DB interfae on dynamodb

func NewDynamoDB

func NewDynamoDB(sess *session.Session, cluster string) *DynamoDB

NewDynamoDB allocates a new DynamoDB instance

DB requirements: 1) conditional creation/update. 2) strong consistency on get/list.

DynamoDB could easily achieve both. Azure table has insert and update APIs.

Q: sounds Azure table is strong consistency for the single key? as table builds on top of
Azure storage, which is strongly consistent.
- insert: assume creating new entry, and will return EntityAlreadyExists if entry exists
- update: support etag, assume updating existing entry, and will return error if entry doesn't exist
[1] https://azure.microsoft.com/en-us/documentation/articles/storage-table-design-guide/
[2] https://msdn.microsoft.com/en-us/library/dd894033.aspx

GCP datastore also provides the similar NoSQL DB. Looks guarantee strong consistency is more complex?

func NewTestDynamoDB

func NewTestDynamoDB(sess *session.Session, suffix string) *DynamoDB

NewTestDynamoDB creates a DynamoDB instance for test

func (*DynamoDB) AddManagerAddrs added in v0.9.4

func (d *DynamoDB) AddManagerAddrs(ctx context.Context, clusterName string, oldAddrs string, newAddrs string) error

AddManagerAddrs updates the managerAddrs record in db

func (*DynamoDB) CreateConfigFile

func (d *DynamoDB) CreateConfigFile(ctx context.Context, cfg *common.ConfigFile) error

CreateConfigFile creates one config file in DB

func (*DynamoDB) CreateDevice

func (d *DynamoDB) CreateDevice(ctx context.Context, dev *common.Device) error

CreateDevice puts a new Device into DB

func (*DynamoDB) CreateJoinToken

func (d *DynamoDB) CreateJoinToken(ctx context.Context, clusterName string, token string, role string) error

CreateJoinToken puts the worker/manager join token in DB.

func (*DynamoDB) CreateService

func (d *DynamoDB) CreateService(ctx context.Context, svc *common.Service) error

CreateService puts a new Service into DB

func (*DynamoDB) CreateServiceAttr

func (d *DynamoDB) CreateServiceAttr(ctx context.Context, attr *common.ServiceAttr) error

CreateServiceAttr puts a new ServiceAttr record into DB

func (*DynamoDB) CreateServiceMember

func (d *DynamoDB) CreateServiceMember(ctx context.Context, member *common.ServiceMember) error

CreateServiceMember creates one EBS serviceMember in DB

func (*DynamoDB) CreateServiceStaticIP added in v0.8.1

func (d *DynamoDB) CreateServiceStaticIP(ctx context.Context, serviceip *common.ServiceStaticIP) error

CreateServiceStaticIP creates one ServiceStaticIP in DB

func (*DynamoDB) CreateSystemTables

func (d *DynamoDB) CreateSystemTables(ctx context.Context) error

CreateSystemTables creates the system tables.

func (*DynamoDB) DeleteConfigFile

func (d *DynamoDB) DeleteConfigFile(ctx context.Context, serviceUUID string, fileID string) error

DeleteConfigFile deletes the config file from DB

func (*DynamoDB) DeleteDevice

func (d *DynamoDB) DeleteDevice(ctx context.Context, clusterName string, deviceName string) error

DeleteDevice deletes the Device from DB. The caller should make sure the service is deleted.

func (*DynamoDB) DeleteService

func (d *DynamoDB) DeleteService(ctx context.Context, clusterName string, serviceName string) error

DeleteService deletes the service from DB

func (*DynamoDB) DeleteServiceAttr

func (d *DynamoDB) DeleteServiceAttr(ctx context.Context, serviceUUID string) error

DeleteServiceAttr deletes the service attr from DB

func (*DynamoDB) DeleteServiceMember

func (d *DynamoDB) DeleteServiceMember(ctx context.Context, serviceUUID string, memberIndex int64) error

DeleteServiceMember deletes the serviceMember from DB

func (*DynamoDB) DeleteServiceStaticIP added in v0.8.1

func (d *DynamoDB) DeleteServiceStaticIP(ctx context.Context, staticIP string) error

DeleteServiceStaticIP deletes the service static ip from DB

func (*DynamoDB) DeleteSystemTables

func (d *DynamoDB) DeleteSystemTables(ctx context.Context) error

DeleteSystemTables deletes the system tables.

func (*DynamoDB) GetConfigFile

func (d *DynamoDB) GetConfigFile(ctx context.Context, serviceUUID string, fileID string) (cfg *common.ConfigFile, err error)

GetConfigFile gets the config fileItem from DB

func (*DynamoDB) GetDevice

func (d *DynamoDB) GetDevice(ctx context.Context, clusterName string, deviceName string) (dev *common.Device, err error)

GetDevice gets the device from DB

func (*DynamoDB) GetInitManager

func (d *DynamoDB) GetInitManager(ctx context.Context, clusterName string) (addr string, err error)

GetInitManager gets the init manager address from DB.

func (*DynamoDB) GetJoinToken

func (d *DynamoDB) GetJoinToken(ctx context.Context, clusterName string, role string) (token string, err error)

GetJoinToken gets the worker/manager join token from DB.

func (*DynamoDB) GetManagerAddrs added in v0.9.4

func (d *DynamoDB) GetManagerAddrs(ctx context.Context, clusterName string) (addrs string, err error)

GetManagerAddrs gets the manager addresses from DB.

func (*DynamoDB) GetService

func (d *DynamoDB) GetService(ctx context.Context, clusterName string, serviceName string) (svc *common.Service, err error)

GetService gets the Service from DB

func (*DynamoDB) GetServiceAttr

func (d *DynamoDB) GetServiceAttr(ctx context.Context, serviceUUID string) (attr *common.ServiceAttr, err error)

GetServiceAttr gets the ServiceAttr from DB

func (*DynamoDB) GetServiceMember

func (d *DynamoDB) GetServiceMember(ctx context.Context, serviceUUID string, memberIndex int64) (member *common.ServiceMember, err error)

GetServiceMember gets the serviceMemberItem from DB

func (*DynamoDB) GetServiceStaticIP added in v0.8.1

func (d *DynamoDB) GetServiceStaticIP(ctx context.Context, staticIP string) (serviceip *common.ServiceStaticIP, err error)

GetServiceStaticIP gets the ServiceStaticIP from DB

func (*DynamoDB) ListDevices

func (d *DynamoDB) ListDevices(ctx context.Context, clusterName string) (devs []*common.Device, err error)

ListDevices lists all Devices

func (*DynamoDB) ListServiceMembers

func (d *DynamoDB) ListServiceMembers(ctx context.Context, serviceUUID string) (serviceMembers []*common.ServiceMember, err error)

ListServiceMembers lists all serviceMembers of the service

func (*DynamoDB) ListServices

func (d *DynamoDB) ListServices(ctx context.Context, clusterName string) (services []*common.Service, err error)

ListServices lists all services

func (*DynamoDB) SystemTablesReady

func (d *DynamoDB) SystemTablesReady(ctx context.Context) (tableStatus string, ready bool, err error)

SystemTablesReady checks if all system tables are ready to use

func (*DynamoDB) TakeInitManager

func (d *DynamoDB) TakeInitManager(ctx context.Context, clusterName string, addr string) error

TakeInitManager tries to become the first manager that initializes the swarm cluster and persists the join tokens.

func (*DynamoDB) UpdateServiceAttr

func (d *DynamoDB) UpdateServiceAttr(ctx context.Context, oldAttr *common.ServiceAttr, newAttr *common.ServiceAttr) error

UpdateServiceAttr updates the ServiceAttr in DB. Only support updating ServiceStatus, Replicas or UserAttr at v1, all other attributes are immutable.

func (*DynamoDB) UpdateServiceMember

func (d *DynamoDB) UpdateServiceMember(ctx context.Context, oldMember *common.ServiceMember, newMember *common.ServiceMember) error

UpdateServiceMember updates the ServiceMember in DB

func (*DynamoDB) UpdateServiceMemberVolume added in v0.9.2

func (d *DynamoDB) UpdateServiceMemberVolume(ctx context.Context, member *common.ServiceMember, newVolID string, badVolID string) error

UpdateServiceMemberVolume updates the ServiceMember's volume in DB

func (*DynamoDB) UpdateServiceStaticIP added in v0.8.1

func (d *DynamoDB) UpdateServiceStaticIP(ctx context.Context, oldIP *common.ServiceStaticIP, newIP *common.ServiceStaticIP) error

UpdateServiceStaticIP updates the ServiceStaticIP in DB

func (*DynamoDB) WaitSystemTablesDeleted

func (d *DynamoDB) WaitSystemTablesDeleted(ctx context.Context, maxWaitSeconds int64) error

WaitSystemTablesDeleted waits till all system tables are deleted.

func (*DynamoDB) WaitSystemTablesReady

func (d *DynamoDB) WaitSystemTablesReady(ctx context.Context, maxWaitSeconds int64) error

WaitSystemTablesReady waits till the system tables are ready

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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