Restructure backend
This commit is contained in:
parent
0e1045301a
commit
661c1e9aa1
6 changed files with 95 additions and 28 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue