From 53667583c094252818f203b9233a7726d0a4e8a0 Mon Sep 17 00:00:00 2001 From: "Pablo M. Bermudo Garay" Date: Wed, 9 Feb 2022 19:58:30 +0100 Subject: Add proactive de-duplication to the memory backend --- objectstore/objecstore.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'objectstore/objecstore.go') 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, + } +} -- cgit v1.2.3-70-g09d2