forked from TrueCloudLab/frostfs-node
[#477] engine: Make generateShardID function independent
This function does not use any engine internal states. This way it can be reused in tests. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
bd5ce4535a
commit
2716000b08
1 changed files with 2 additions and 2 deletions
|
@ -24,7 +24,7 @@ func (e *StorageEngine) AddShard(opts ...shard.Option) (*shard.ID, error) {
|
|||
e.mtx.Lock()
|
||||
defer e.mtx.Unlock()
|
||||
|
||||
id, err := e.generateShardID()
|
||||
id, err := generateShardID()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not generate shard ID")
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ func (e *StorageEngine) AddShard(opts ...shard.Option) (*shard.ID, error) {
|
|||
return id, nil
|
||||
}
|
||||
|
||||
func (e *StorageEngine) generateShardID() (*shard.ID, error) {
|
||||
func generateShardID() (*shard.ID, error) {
|
||||
uid, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue