Add string representation of boltdb shipper mode (#5982)

pull/5719/head^2
Christian Simon 3 years ago committed by GitHub
parent 66a4692423
commit 337659602e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      pkg/storage/stores/shipper/shipper_index_client.go

@ -27,9 +27,11 @@ import (
"github.com/grafana/loki/pkg/util/spanlogger"
)
type Mode int
const (
// ModeReadWrite is to allow both read and write
ModeReadWrite = iota
ModeReadWrite Mode = iota
// ModeReadOnly is to allow only read operations
ModeReadOnly
// ModeWriteOnly is to allow only write operations
@ -42,6 +44,18 @@ const (
UploadInterval = 1 * time.Minute
)
func (m Mode) String() string {
switch m {
case ModeReadWrite:
return "read-write"
case ModeReadOnly:
return "read-only"
case ModeWriteOnly:
return "write-only"
}
return "unknown"
}
type boltDBIndexClient interface {
QueryWithCursor(_ context.Context, c *bbolt.Cursor, query index.Query, callback index.QueryPagesCallback) error
NewWriteBatch() index.WriteBatch
@ -60,7 +74,7 @@ type Config struct {
IndexGatewayClientConfig IndexGatewayClientConfig `yaml:"index_gateway_client"`
BuildPerTenantIndex bool `yaml:"build_per_tenant_index"`
IngesterName string `yaml:"-"`
Mode int `yaml:"-"`
Mode Mode `yaml:"-"`
IngesterDBRetainPeriod time.Duration `yaml:"-"`
}
@ -104,7 +118,7 @@ func NewShipper(cfg Config, storageClient client.ObjectClient, limits downloads.
return nil, err
}
level.Info(util_log.Logger).Log("msg", fmt.Sprintf("starting boltdb shipper in %d mode", cfg.Mode))
level.Info(util_log.Logger).Log("msg", fmt.Sprintf("starting boltdb shipper in %s mode", cfg.Mode))
return &shipper, nil
}

Loading…
Cancel
Save