summaryrefslogtreecommitdiff
path: root/objectstore/objecstore.go
blob: 7cbb48186320702e0b7677ddf58a1b0594153d16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// ObjectStore (backend) interface
//
// Licensed under CC0 1.0 Universal:
// https://creativecommons.org/publicdomain/zero/1.0/legalcode
package objectstore

import (
	"fmt"
)

type ObjectStore interface {
	CreateObject(bucketId string, objectId string, content []byte) 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,
	}
}