Restructure backend

This commit is contained in:
Alexander Neumann 2014-12-21 15:57:41 +01:00
parent 0e1045301a
commit 661c1e9aa1
6 changed files with 95 additions and 28 deletions

View file

@ -6,6 +6,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
"sync"
)
// IDSize contains the size of an ID, in bytes.
@ -14,6 +15,8 @@ const IDSize = sha256.Size
// References content within a repository.
type ID []byte
var idPool = sync.Pool{New: func() interface{} { return ID(make([]byte, IDSize)) }}
// ParseID converts the given string to an ID.
func ParseID(s string) (ID, error) {
b, err := hex.DecodeString(s)