-
Notifications
You must be signed in to change notification settings - Fork 342
/
database.go
57 lines (49 loc) · 1.67 KB
/
database.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package params
import (
"time"
)
type Config struct {
Type string
Postgres *Postgres
DynamoDB *DynamoDB
Local *Local
}
type Local struct {
// Path - Local directory path to store the DB files
Path string
// SyncWrites - Sync ensures data written to disk on each write instead of mem cache
SyncWrites bool
// PrefetchSize - Number of elements to prefetch while iterating
PrefetchSize int
// EnableLogging - Enable store and badger (trace only) logging
EnableLogging bool
}
type Postgres struct {
ConnectionString string
MaxOpenConnections int32
MaxIdleConnections int32
ConnectionMaxLifetime time.Duration
ScanPageSize int
Metrics bool
}
type DynamoDB struct {
// The name of the DynamoDB table to be used as KV
TableName string
// Maximal number of items per page during scan operation
ScanLimit int64
// The endpoint URL of the DynamoDB endpoint
// Can be used to redirect to DynamoDB on AWS, local docker etc.
Endpoint string
// AWS connection details - region, profile and credentials
// This will override any such details that are already exist in the system
// While in general, AWS region and credentials are configured in the system for AWS usage,
// these can be used to specify fake values, that cna be used to connect to local DynamoDB,
// in case there are no credentials configured in the system
// This is a client requirement as described in section 4 in
// https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html
AwsRegion string
AwsProfile string
AwsAccessKeyID string
AwsSecretAccessKey string
HealthCheckInterval time.Duration
}