Skip to content

Feat/0x5459/store minor refactor#930

Open
0x5459 wants to merge 13 commits intomainfrom
feat/0x5459/store-minor-refactor
Open

Feat/0x5459/store minor refactor#930
0x5459 wants to merge 13 commits intomainfrom
feat/0x5459/store-minor-refactor

Conversation

@0x5459
Copy link
Contributor

@0x5459 0x5459 commented Aug 31, 2023

关联的Issues (Related Issues)

改动 (Proposed Changes)

存储插件接口改动

type Store interface {
	// Type returns the type of this store, just for display.
	Type() string
	// Version returns the version of this store, just for display.
	Version() string
	Instance(context.Context) string
	// InstanceConfig returns the configuration of this store.
	InstanceConfig(ctx context.Context) Config
	// InstanceInfo returns the information of this store.
	InstanceInfo(ctx context.Context) (InstanceInfo, error)

	// SubPath returns the subpath of given params
	// if `pathType` is `PathTypeCustom` then `custom` is not nil otherwise `sectorID` is not nil
	//
	// Example:
	// ```go
	// assert(SubPath(context.TODO(), "cache", sid4040_1001, nil) == ("cache/s-t04040-1001", nil))
	// assert(SubPath(context.TODO(), "sealed", sid4040_1001, nil) == ("sealed/s-t04040-1001", nil))
	// assert(SubPath(context.TODO(), "update", sid4040_1001, nil) == ("update/s-t04040-1001", nil))
	// assert(SubPath(context.TODO(), "update-cache", sid4040_1001, nil) == ("update-cache/s-t04040-1001", nil))
	// assert(SubPath(context.TODO(), "custom", sid4040_1001, "path/to/anything") == ("path/to/anything", nil))
	// -- OR --
	// assert(SubPath(context.TODO(), "cache", sid4040_1001, nil) == ("myprefix/mycache/mysubdir/s-t04040-1001", nil))
	// assert(SubPath(context.TODO(), "sealed", sid4040_1001, nil) == ("myprefix/mysealed/mysubdir/s-t04040-1001", nil))
	// assert(SubPath(context.TODO(), "update", sid4040_1001, nil) == ("myprefix/myupdate/mysubdir/s-t04040-1001", nil))
	// assert(SubPath(context.TODO(), "update-cache", sid4040_1001, nil) == ("myprefix/myupdate-cache/mysubdir/s-t04040-1001", nil))
	// ...
	// ```
	SubPath(ctx context.Context, pathType PathType, sectorID *SectorID, custom *string) (subPath string, err error)
}

附注 (Additional Info)

自查清单 (Checklist)

在你认为本 PR 满足被审阅的标准之前,需要确保 / Before you mark the PR ready for review, please make sure that:

  • 符合 Venus 项目管理规范中关于 PR 的相关标准 / The PR follows the PR standards set out in the Venus project management guidelines
  • 具有清晰明确的 commit message / All commits have a clear commit message.
  • 包含相关的的测试用例或者不需要新增测试用例 / This PR has tests for new functionality or change in behaviour or not need to add new tests.
  • 包含相关的的指南以及文档或者不需要新增文档 / This PR has updated usage guidelines and documentation or not need
  • 通过必要的检查项 / All checks are green

@0x5459 0x5459 force-pushed the feat/0x5459/store-minor-refactor branch 2 times, most recently from 1056a96 to ab28ed7 Compare August 31, 2023 09:53
@0x5459 0x5459 marked this pull request as draft September 1, 2023 03:02
@0x5459 0x5459 force-pushed the feat/0x5459/store-minor-refactor branch 9 times, most recently from ae01f5e to 382457c Compare September 5, 2023 10:23
@0x5459 0x5459 force-pushed the feat/0x5459/store-minor-refactor branch 9 times, most recently from 71c6416 to 89811f1 Compare September 14, 2023 03:22
@0x5459 0x5459 marked this pull request as ready for review September 14, 2023 03:22
@0x5459 0x5459 force-pushed the feat/0x5459/store-minor-refactor branch 4 times, most recently from 9c5bbf7 to 1815f7e Compare September 18, 2023 03:01
@0x5459 0x5459 force-pushed the feat/0x5459/store-minor-refactor branch from 0e8696b to be26abc Compare October 17, 2023 01:33
@0x5459 0x5459 force-pushed the feat/0x5459/store-minor-refactor branch from be26abc to 8928215 Compare October 20, 2023 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

1 participant