Documentation ¶
Overview ¶
package dynamodb implements ServiceDiscovery interface using dynamodb tables.
Index ¶
Constants ¶
View Source
const DefaultAwsRegion = "eu-west-1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type LocalConfig ¶
type LocalConfig struct { DdbTableName string `yaml:"ddb_table_name"` Endpoint string `yaml:"endpoint"` AwsRegion string `yaml:"aws_region"` }
func (LocalConfig) HasError ¶
func (cfg LocalConfig) HasError() error
type ServiceDiscoveryDynamoDB ¶
type ServiceDiscoveryDynamoDB struct {
// contains filtered or unexported fields
}
ServiceDiscoveryDynamoDB holds the details required to implement a ServiceDiscovery using dynamodb TODO: should this be private? name is too long
func New ¶
func New(cfg Config) (*ServiceDiscoveryDynamoDB, error)
New will take in the Config provided and attempt to create a connection to DynamoDB. If the cfg does not set the Access and Secret key (if they are the) empty string, it will fall back to the ENV variables and the IAM credentials of the instance (if running in EC2)
func NewDynamoDBLocal ¶
func NewDynamoDBLocal(cfg LocalConfig) (*ServiceDiscoveryDynamoDB, error)
NewDynamoDBLocal uses a local instance of dynamodb running on endpoint
func (*ServiceDiscoveryDynamoDB) ListWorkers ¶
func (svc *ServiceDiscoveryDynamoDB) ListWorkers(service sd.ServiceRole, earliestLastSeen time.Time) ([]*sd.ServiceWorker, error)
func (*ServiceDiscoveryDynamoDB) RegisterWorker ¶
func (svc *ServiceDiscoveryDynamoDB) RegisterWorker(worker sd.ServiceWorker, heartBeat time.Time) error
type ServiceWorkerDdb ¶
type ServiceWorkerDdb struct { ServiceId string `dynamodbav:"serviceId"` WorkerId string `dynamodbav:"workerId"` LastSeen time.Time `dynamodbav:"last_seen_time,unixtime"` Endpoint string `dynamodbav:"endpoint"` Role string `dynamodbav:"role"` DeployGroup string `dynamodbav:"deploy_group"` ServiceName string `dynamodbav:"service_name"` }
Click to show internal directories.
Click to hide internal directories.