Skip to content

Commit caeb4ac

Browse files
committed
feat(store): update plugin api
1 parent 91e5e3b commit caeb4ac

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

manager-plugin/objstore/objstore.go

+17-13
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,30 @@ type Store interface {
8484
// InstanceInfo returns the information of this store.
8585
InstanceInfo(ctx context.Context) (InstanceInfo, error)
8686

87-
// Get returns an io.ReadCloser object for reading the file corresponding to the fullPath from this store.
88-
Get(ctx context.Context, fullPath string) (io.ReadCloser, error)
89-
// Del removes the file corresponding to given path from this store
90-
Del(ctx context.Context, fullPath string) error
91-
// Stat returns a Stat describing the file corresponding to given path
92-
Stat(ctx context.Context, fullPath string) (Stat, error)
93-
// Put copies from src to dstPath until either EOF is reached
87+
// Get returns an io.ReadCloser object for reading the file corresponding to the resourceName from this store.
88+
// the resourceName value looks like this:
89+
// - "cache/sc-02-data-tree-r-last.dat"
90+
Get(ctx context.Context, resourceName string) (io.ReadCloser, error)
91+
// Del removes the file corresponding to given resourceName from this store
92+
Del(ctx context.Context, resourceName string) error
93+
// Stat returns a Stat describing the file corresponding to given resourceName
94+
Stat(ctx context.Context, resourceName string) (Stat, error)
95+
// Put copies from src to destResourceName until either EOF is reached
9496
// on src or an error occurs.
9597
// It returns the number of bytes copied.
96-
Put(ctx context.Context, dstFullPath string, src io.Reader) (int64, error)
98+
Put(ctx context.Context, destResourceName string, src io.Reader) (int64, error)
9799

98-
// FullPath returns the full path of the given relative path.
100+
// Uri returns the uri corresponding to the given resourceName in this store.
99101
//
102+
// Example:
100103
// ```go
101-
// assert(FullPath(context.TODO(), "cache/s-t04040-1001") == "depends_on_your_store/cache/s-t04040-1001")
104+
// assert(Uri(context.TODO(), "cache/s-t04040-1001") == "/path/to/my_prefix/cache/s-t04040-1001")
105+
// assert(Uri(context.TODO(), "cache/s-t04040-1001") == "/path/to/3777f34f2e99477b512a7a4507318f72")
106+
// ...
102107
// ```
103-
//
104108
// Example(for filesystem):
105109
// ```go
106-
// assert(FullPath(context.TODO(), "cache/s-t04040-1001") == "/path/to/your_store_dir/cache/s-t04040-1001")
110+
// assert(Uri(context.TODO(), "cache/s-t04040-1001") == "/path/to/my_store_dir/cache/s-t04040-1001")
107111
// ```
108-
FullPath(ctx context.Context, relPath string) string
112+
Uri(ctx context.Context, resourceName string) (string, error)
109113
}

0 commit comments

Comments
 (0)