From e43a46e9822a05dd0345a7676e03285ddf83205e Mon Sep 17 00:00:00 2001 From: "kim (grufwub)" Date: Sat, 11 Sep 2021 20:12:47 +0100 Subject: add git.iim.gay/grufwub/go-store for storage backend, replacing blob.Storage Signed-off-by: kim (grufwub) --- .../grufwub/go-store/storage/transform.go | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 vendor/git.iim.gay/grufwub/go-store/storage/transform.go (limited to 'vendor/git.iim.gay/grufwub/go-store/storage/transform.go') diff --git a/vendor/git.iim.gay/grufwub/go-store/storage/transform.go b/vendor/git.iim.gay/grufwub/go-store/storage/transform.go new file mode 100644 index 000000000..3863dd774 --- /dev/null +++ b/vendor/git.iim.gay/grufwub/go-store/storage/transform.go @@ -0,0 +1,25 @@ +package storage + +// KeyTransform defines a method of converting store keys to storage paths (and vice-versa) +type KeyTransform interface { + // KeyToPath converts a supplied key to storage path + KeyToPath(string) string + + // PathToKey converts a supplied storage path to key + PathToKey(string) string +} + +type nopKeyTransform struct{} + +// NopTransform returns a nop key transform (i.e. key = path) +func NopTransform() KeyTransform { + return &nopKeyTransform{} +} + +func (t *nopKeyTransform) KeyToPath(key string) string { + return key +} + +func (t *nopKeyTransform) PathToKey(path string) string { + return path +} -- cgit v1.2.3