2019-01-24 16:26:36 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-12 09:14:16 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package satellitedb
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/skyrings/skyring-common/tools/uuid"
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// bytesToUUID is used to convert []byte to UUID
|
|
|
|
func bytesToUUID(data []byte) (uuid.UUID, error) {
|
|
|
|
var id uuid.UUID
|
|
|
|
|
|
|
|
copy(id[:], data)
|
|
|
|
if len(id) != len(data) {
|
2018-11-13 08:27:42 +00:00
|
|
|
return uuid.UUID{}, errs.New("Invalid uuid")
|
2018-11-12 09:14:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return id, nil
|
|
|
|
}
|