forked from TrueCloudLab/frostfs-sdk-go
e2011832eb
Homomorphic hashing of object payload is not always necessary. There is a need to provide ability to skip calculation. It's also worth to not calculate it by default since current implementation of Tillich-Zemor algorithm has large resource cost. Do not calculate homomorphic checksum in `Slicer` methods by default. Provide option to enable the calculation. Make tests to randomize calculation flag and assert results according to it. Refs #342. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
27 lines
653 B
Go
27 lines
653 B
Go
package slicer
|
|
|
|
// Options groups Slicer options.
|
|
type Options struct {
|
|
objectPayloadLimit uint64
|
|
|
|
currentNeoFSEpoch uint64
|
|
|
|
withHomoChecksum bool
|
|
}
|
|
|
|
// SetObjectPayloadLimit specifies data size limit for produced physically
|
|
// stored objects.
|
|
func (x *Options) SetObjectPayloadLimit(l uint64) {
|
|
x.objectPayloadLimit = l
|
|
}
|
|
|
|
// SetCurrentNeoFSEpoch sets current NeoFS epoch.
|
|
func (x *Options) SetCurrentNeoFSEpoch(e uint64) {
|
|
x.currentNeoFSEpoch = e
|
|
}
|
|
|
|
// CalculateHomomorphicChecksum makes Slicer to calculate and set homomorphic
|
|
// checksum of the processed objects.
|
|
func (x *Options) CalculateHomomorphicChecksum() {
|
|
x.withHomoChecksum = true
|
|
}
|