/
app.go
43 lines (36 loc) · 893 Bytes
/
app.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
package ctx
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/dgraph-io/ristretto"
"github.com/rs/zerolog"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/trace"
)
type S3BackendConfig struct {
BucketName string
MaxObjectSize int
MaxAgeSeconds int
TransferBufSize int
Credentials aws.Credentials
S3 s3.Options
}
type HttpConfig struct {
Listen string
}
type Config struct {
Ristretto ristretto.Config
S3Backends []S3BackendConfig
HttpConfig HttpConfig
// NumCounters: 1e10, // number of keys to track frequency of (10M).
// MaxCost: 1 << 30, // maximum cost of cache (1GB).
// BufferItems: 64, // number of keys per Get buffer.
}
type AppCtx struct {
Log zerolog.Logger
Cfg Config
Tracer trace.Tracer
Meter metric.Meter
Ctx context.Context
}