1ef06fae99
We were using mixed types for nonce fields. Protobuf have storj.Nonce, metabase have []byte. This change is a refactoring to have everywere its possible only storj.Nonce. Change-Id: Id54bd8481f30c721cdaf3df79206d25e7cfdab55
55 lines
1.3 KiB
Go
55 lines
1.3 KiB
Go
// Copyright (C) 2021 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package metabasetest
|
|
|
|
import (
|
|
"time"
|
|
|
|
"storj.io/common/storj"
|
|
"storj.io/storj/satellite/metabase"
|
|
)
|
|
|
|
// DefaultRedundancy contains default redundancy scheme.
|
|
var DefaultRedundancy = storj.RedundancyScheme{
|
|
Algorithm: storj.ReedSolomon,
|
|
ShareSize: 2048,
|
|
RequiredShares: 1,
|
|
RepairShares: 1,
|
|
OptimalShares: 1,
|
|
TotalShares: 1,
|
|
}
|
|
|
|
// DefaultEncryption contains default encryption parameters.
|
|
var DefaultEncryption = storj.EncryptionParameters{
|
|
CipherSuite: storj.EncAESGCM,
|
|
BlockSize: 29 * 256,
|
|
}
|
|
|
|
// DefaultNonce contains default nonce.
|
|
var DefaultNonce = func() storj.Nonce {
|
|
var nonce storj.Nonce
|
|
copy(nonce[:], []byte{4})
|
|
return nonce
|
|
}()
|
|
|
|
// DefaultRawSegment returns default raw segment.
|
|
func DefaultRawSegment(obj metabase.ObjectStream, segmentPosition metabase.SegmentPosition) metabase.RawSegment {
|
|
return metabase.RawSegment{
|
|
StreamID: obj.StreamID,
|
|
Position: segmentPosition,
|
|
RootPieceID: storj.PieceID{1},
|
|
Pieces: metabase.Pieces{{Number: 0, StorageNode: storj.NodeID{2}}},
|
|
CreatedAt: time.Now(),
|
|
|
|
EncryptedKey: []byte{3},
|
|
EncryptedKeyNonce: DefaultNonce,
|
|
EncryptedETag: []byte{5},
|
|
|
|
EncryptedSize: 1024,
|
|
PlainSize: 512,
|
|
PlainOffset: 0,
|
|
Redundancy: DefaultRedundancy,
|
|
}
|
|
}
|