MCPcopy Index your code
hub / github.com/uber/aresdb / OpenVectorPartyFileForWrite

Method OpenVectorPartyFileForWrite

diskstore/local_diskstore.go:317–337  ·  view source on GitHub ↗

OpenVectorPartyFileForWrite : Creates/truncates the vector party file at the specified batchVersion for write.

(table string, columnID int, shard, batchID int, batchVersion uint32,
	seqNum uint32)

Source from the content-addressed store, hash-verified

315
316// OpenVectorPartyFileForWrite : Creates/truncates the vector party file at the specified batchVersion for write.
317func (l LocalDiskStore) OpenVectorPartyFileForWrite(table string, columnID int, shard, batchID int, batchVersion uint32,
318 seqNum uint32) (io.WriteCloser, error) {
319 batchIDTimeStr := daysSinceEpochToTimeStr(batchID)
320 batchDir := GetPathForTableArchiveBatchDir(l.rootPath, table, shard, batchIDTimeStr, batchVersion, seqNum)
321 if err := os.MkdirAll(batchDir, 0755); err != nil {
322 return nil, utils.StackError(err, "Failed to make dirs for path: %s", batchDir)
323 }
324 vectorPartyFilePath := GetPathForTableArchiveBatchColumnFile(l.rootPath, table, shard, batchIDTimeStr, batchVersion,
325 seqNum, columnID)
326
327 mode := os.O_CREATE | os.O_WRONLY
328 if l.diskStoreConfig.WriteSync {
329 mode |= os.O_SYNC
330 }
331
332 f, err := os.OpenFile(vectorPartyFilePath, mode, 0644)
333 if err != nil {
334 return nil, utils.StackError(err, "Failed to open vector party file: %s for write", vectorPartyFilePath)
335 }
336 return f, nil
337}
338
339// DeleteBatchVersions deletes all old batches with the specified batchID that have version lower than or equal to
340// the specified batch version. All columns of those batches will be deleted.

Callers

nothing calls this directly

Calls 5

StackErrorFunction · 0.92
daysSinceEpochToTimeStrFunction · 0.85
MkdirAllMethod · 0.65

Tested by

no test coverage detected