watchtower: use a stable blob identifier
In this commit, we add an Identifier method to the blob.Type struct which returns a unique identifier for a given blob type. This identifier is then used for initialising the disk overflow queue of the given client.
This commit is contained in:
2 files changed
+20
-7
No files matched your search
@@ -350,10 +350,12 @@ func New(config *Config) (*TowerClient, error) {
|
||||
cfg.WriteTimeout = DefaultWriteTimeout
|
||||
}
|
||||
|
||||
prefix := "(legacy)"
|
||||
if cfg.Policy.IsAnchorChannel() {
|
||||
prefix = "(anchor)"
|
||||
identifier, err := cfg.Policy.BlobType.Identifier()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
prefix := fmt.Sprintf("(%s)", identifier)
|
||||
|
||||
plog := build.NewPrefixLog(prefix, log)
|
||||
|
||||
// Load the sweep pkscripts that have been generated for all previously
|
||||
@@ -363,10 +365,7 @@ func New(config *Config) (*TowerClient, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var (
|
||||
policy = cfg.Policy.BlobType.String()
|
||||
queueDB = cfg.DB.GetDBQueue([]byte(policy))
|
||||
)
|
||||
queueDB := cfg.DB.GetDBQueue([]byte(identifier))
|
||||
queue, err := NewDiskOverflowQueue[*wtdb.BackupID](
|
||||
queueDB, cfg.MaxTasksInMemQueue, plog,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user