forked from DmitriyHellyeah/near-lake-framework-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
52 lines (46 loc) · 1.45 KB
/
config.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
package nearlake
import "time"
const (
MainnetBucketName = "near-lake-data-mainnet"
TestnetBucketName = "near-lake-data-testnet"
AwsRegion = "eu-central-1"
)
type S3Config struct {
AWSAccessKeyId string
AWSSecretAccessKey string
Region string
Bucket string
Delimiter string
MaxRetries int
StartAfter uint64
NumberOfBlocksRequested uint64
RequestPayer string
BlocksCountWaiting int // To prevent requests spamming if data does not exist yet
RequestWaitingTimeout time.Duration // To prevent requests spamming if data does not exist yet
ShardsWaitingTimeout time.Duration // sometimes shards can appears later then the blocks list
}
func InitDefaultMainnetConfig(startAfter, numberOfBlockRequested uint64) S3Config {
cfg := InitDefaultConfig()
cfg.Bucket = MainnetBucketName
cfg.StartAfter = startAfter
cfg.NumberOfBlocksRequested = numberOfBlockRequested
return cfg
}
func InitDefaultTestnetConfig(startAfter, numberOfBlockRequested uint64) S3Config {
cfg := InitDefaultConfig()
cfg.Bucket = TestnetBucketName
cfg.StartAfter = startAfter
cfg.NumberOfBlocksRequested = numberOfBlockRequested
return cfg
}
func InitDefaultConfig() S3Config {
return S3Config{
Region: AwsRegion,
Delimiter: "/",
MaxRetries: 3,
RequestPayer: "requester",
BlocksCountWaiting: 10,
RequestWaitingTimeout: 10,
ShardsWaitingTimeout: 2,
}
}