|
|
|
@ -24,6 +24,8 @@ import ( |
|
|
|
|
type deleteRequestsTable struct { |
|
|
|
|
indexStorageClient storage.Client |
|
|
|
|
dbPath string |
|
|
|
|
updatedAt time.Time |
|
|
|
|
uploadedAt time.Time |
|
|
|
|
|
|
|
|
|
boltdbIndexClient *local.BoltIndexClient |
|
|
|
|
db *bbolt.DB |
|
|
|
@ -98,6 +100,10 @@ func (t *deleteRequestsTable) loop() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t *deleteRequestsTable) uploadFile() error { |
|
|
|
|
if t.uploadedAt.After(t.updatedAt) { |
|
|
|
|
level.Debug(util_log.Logger).Log("msg", "skipping uploading delete requests db since there have been no updates to the table since last upload") |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
level.Debug(util_log.Logger).Log("msg", "uploading delete requests db") |
|
|
|
|
|
|
|
|
|
tempFilePath := fmt.Sprintf("%s.%s", t.dbPath, tempFileSuffix) |
|
|
|
@ -144,7 +150,12 @@ func (t *deleteRequestsTable) uploadFile() error { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return t.indexStorageClient.PutFile(context.Background(), DeleteRequestsTableName, deleteRequestsIndexFileName, f) |
|
|
|
|
if err := t.indexStorageClient.PutFile(context.Background(), DeleteRequestsTableName, deleteRequestsIndexFileName, f); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
t.uploadedAt = time.Now() |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (t *deleteRequestsTable) Stop() { |
|
|
|
@ -178,6 +189,7 @@ func (t *deleteRequestsTable) BatchWrite(ctx context.Context, batch index.WriteB |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
t.updatedAt = time.Now() |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|