Skip to content

BlockFiles: versioning support #16997

@AskAlexSharov

Description

@AskAlexSharov

follow-up on #16984 (comment)

  1. re-visit FindFilesWithVersionsByPattern and how ok handled compare to err
    if de-facto it's always handled same way - then think again on API of FindFilesWithVersionsByPattern - provide some examples in code - on how this func Expected to be used.

Currently we are wordy:

fPathMask, err := version.ReplaceVersionWithMask(filepath.Join(snapDir, t.FileName(t.Versions().Current, r.From(), r.To())))
if err != nil {
	return fmt.Errorf("[merge] can't replace with mask in file %s: %w", fPathMask, err)
}
fPath, _, ok, err := version.FindFilesWithVersionsByPattern(fPathMask)
if err != nil {
	_, fName := filepath.Split(fPath)
	return fmt.Errorf("[merge] find files by pattern err %w fname %s", err, fName)
}
if !ok {
	_, fName := filepath.Split(fPath)
	return fmt.Errorf("[merge] find files by pattern err %w fname %s", os.ErrNotExist, fName)
}
  1. Seems we clearly see new concept:
  • new files names (which we planing to build)
  • existing files names (which we got from disk)
    Maybe if we thin more in this direction - we will find better API/Types - to make "wrong version" impossible at compile-time.
  1. Block Files are far from state files (code-wise). Create 1-2 GitHub issues to make small step towards unification (step-by-step we will get there).

  2. What is next step about snaptype.ParseFileName?

  3. Please add here more follow-ups - about challenges we faced during release/3.1, building indexes on old files if have some #16984, and other tasks


sub-tasks:

Sub-issues

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions