|
|
@ -8,7 +8,6 @@ import (
|
|
|
|
"crypto/sha256"
|
|
|
|
"crypto/sha256"
|
|
|
|
"encoding/hex"
|
|
|
|
"encoding/hex"
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"hash"
|
|
|
|
"hash"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
@ -24,21 +23,6 @@ var (
|
|
|
|
ErrSizeMismatch = errors.New("Content size does not match")
|
|
|
|
ErrSizeMismatch = errors.New("Content size does not match")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ErrRangeNotSatisfiable represents an error which request range is not satisfiable.
|
|
|
|
|
|
|
|
type ErrRangeNotSatisfiable struct {
|
|
|
|
|
|
|
|
FromByte int64
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// IsErrRangeNotSatisfiable returns true if the error is an ErrRangeNotSatisfiable
|
|
|
|
|
|
|
|
func IsErrRangeNotSatisfiable(err error) bool {
|
|
|
|
|
|
|
|
_, ok := err.(ErrRangeNotSatisfiable)
|
|
|
|
|
|
|
|
return ok
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (err ErrRangeNotSatisfiable) Error() string {
|
|
|
|
|
|
|
|
return fmt.Sprintf("Requested range %d is not satisfiable", err.FromByte)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ContentStore provides a simple file system based storage.
|
|
|
|
// ContentStore provides a simple file system based storage.
|
|
|
|
type ContentStore struct {
|
|
|
|
type ContentStore struct {
|
|
|
|
storage.ObjectStorage
|
|
|
|
storage.ObjectStorage
|
|
|
|