DeleteColumn : Deletes all batches of the specified column.
(table string, columnID int, shard int)
| 394 | |
| 395 | // DeleteColumn : Deletes all batches of the specified column. |
| 396 | func (l LocalDiskStore) DeleteColumn(table string, columnID int, shard int) error { |
| 397 | tableArchiveBatchRootDir := GetPathForTableArchiveBatchRootDir(l.rootPath, table, shard) |
| 398 | tableArchiveBatchDirs, err := ioutil.ReadDir(tableArchiveBatchRootDir) |
| 399 | |
| 400 | if err != nil { |
| 401 | if os.IsNotExist(err) { |
| 402 | return nil |
| 403 | } |
| 404 | return utils.StackError(err, "Failed to list archive batches from table archive batch root dir: %s", |
| 405 | tableArchiveBatchRootDir) |
| 406 | } |
| 407 | for _, f := range tableArchiveBatchDirs { |
| 408 | if f.IsDir() { |
| 409 | if batchID, batchVersion, seqNum, err := ParseBatchIDAndVersionName(f.Name()); err == nil { |
| 410 | vectorPartyFilePath := GetPathForTableArchiveBatchColumnFile(l.rootPath, table, shard, batchID, |
| 411 | batchVersion, seqNum, columnID) |
| 412 | if err = os.Remove(vectorPartyFilePath); err != nil && !os.IsNotExist(err) { |
| 413 | utils.GetLogger().With( |
| 414 | "vectorPartyFilePath", vectorPartyFilePath, |
| 415 | "err", err, |
| 416 | ).Warn("Failed to delete a vector party file") |
| 417 | continue |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | return nil |
| 423 | } |
| 424 | |
| 425 | func daysSinceEpochToTime(daysSinceEpoch int) time.Time { |
| 426 | secondsSinceEpoch := int64(daysSinceEpoch) * 86400 |
nothing calls this directly
no test coverage detected