| 1 |
package attachment |
| 2 |
|
| 3 |
import ( |
| 4 |
"io" |
| 5 |
"time" |
| 6 |
) |
| 7 |
|
| 8 |
// backendObject represents an object stored in a backend. |
| 9 |
type object struct { |
| 10 |
ID string |
| 11 |
Size int64 |
| 12 |
LastModified time.Time |
| 13 |
} |
| 14 |
|
| 15 |
// backend is a minimal I/O interface for storing and retrieving attachment files. |
| 16 |
// It has no knowledge of size tracking, limiting, or ID validation. |
| 17 |
type backend interface { |
| 18 |
Put(id string, reader io.Reader, untrustedLength int64) error |
| 19 |
Get(id string) (io.ReadCloser, int64, error) |
| 20 |
List() ([]object, error) |
| 21 |
Delete(ids ...string) error |
| 22 |
DeleteIncomplete(cutoff time.Time) error |
| 23 |
} |