Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions go/store/nbs/archive_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,12 @@ func (asw *ArchiveStreamWriter) Remove() error {
return os.Remove(asw.writer.path)
}

// FlushToFile writes the archive to disk. The input is the directory where the file should be written, the file name
// will be the footer hash + ".darc" as a suffix.
func (asw *ArchiveStreamWriter) FlushToFile(fullPath string) error {
return asw.writer.flushToFile(fullPath)
}

func (asw *ArchiveStreamWriter) writeArchiveToChunker(chunker ArchiveToChunker) (uint32, error) {
dict := chunker.dict

Expand Down
2 changes: 2 additions & 0 deletions go/store/nbs/cmp_chunk_table_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type GenericTableWriter interface {
Remove() error
// Terminate the inprogress write and attempt to cleanup any resources.
Cancel() error
// FlushToFile writes the archive to disk. The input is the directory where the file should be written.
FlushToFile(fullPath string) error
}

const defaultTableSinkBlockSize = 2 * 1024 * 1024
Expand Down
3 changes: 2 additions & 1 deletion go/store/nbs/file_table_persister.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type fsTablePersister struct {

var _ tablePersister = &fsTablePersister{}
var _ tableFilePersister = &fsTablePersister{}
var _ movingTableFilePersister = &fsTablePersister{}

func (ftp *fsTablePersister) Open(ctx context.Context, name hash.Hash, chunkCount uint32, stats *Stats) (chunkSource, error) {
return newFileTableReader(ctx, ftp.dir, name, chunkCount, ftp.q, ftp.mmapArchiveIndexes, stats)
Expand Down Expand Up @@ -166,7 +167,7 @@ func (ftp *fsTablePersister) CopyTableFile(_ context.Context, r io.Reader, fileI
return file.Rename(tn, path)
}

func (ftp *fsTablePersister) TryMoveCmpChunkTableWriter(ctx context.Context, filename string, w *CmpChunkTableWriter) error {
func (ftp *fsTablePersister) TryMoveCmpChunkTableWriter(ctx context.Context, filename string, w GenericTableWriter) error {
path := filepath.Join(ftp.dir, filename)
ftp.removeMu.Lock()
if ftp.toKeep != nil {
Expand Down
Loading