summaryrefslogtreecommitdiff
path: root/objectstore/objecstore.go
diff options
context:
space:
mode:
authorPablo M. Bermudo Garay <pablombg@gmail.com>2022-02-09 19:58:30 +0100
committerPablo M. Bermudo Garay <pablombg@gmail.com>2022-02-10 13:14:19 +0100
commit53667583c094252818f203b9233a7726d0a4e8a0 (patch)
tree7bcc7cbaf784f149113cba85a837515d70ae1c87 /objectstore/objecstore.go
parentc488ed1f80fd54846170c0ab04ce59a69f52a9e5 (diff)
Add proactive de-duplication to the memory backend
Diffstat (limited to 'objectstore/objecstore.go')
-rw-r--r--objectstore/objecstore.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/objectstore/objecstore.go b/objectstore/objecstore.go
index 7509fad..f4985c9 100644
--- a/objectstore/objecstore.go
+++ b/objectstore/objecstore.go
@@ -4,8 +4,26 @@
// https://creativecommons.org/publicdomain/zero/1.0/legalcode
package objectstore
+import (
+ "fmt"
+)
+
type ObjectStore interface {
- CreateObject(bucketId string, objectId string, content string)
+ CreateObject(bucketId string, objectId string, content string) error
GetObject(bucketId string, objectId string) (string, error)
DeleteObject(bucketId string, objectId string) error
}
+
+type DuplicateError struct {
+ ObjectId string
+}
+
+func (e *DuplicateError) Error() string {
+ return fmt.Sprintf("Duplicate of the '%v' object", e.ObjectId)
+}
+
+func NewDuplicateError(objectId string) error {
+ return &DuplicateError{
+ ObjectId: objectId,
+ }
+}