Documentation ¶
Index ¶
- Variables
- type AppStatusHandlerMock
- func (a *AppStatusHandlerMock) AddUint64(key string, val uint64)
- func (a *AppStatusHandlerMock) Close()
- func (a *AppStatusHandlerMock) Decrement(key string)
- func (a *AppStatusHandlerMock) Increment(key string)
- func (a *AppStatusHandlerMock) IsInterfaceNil() bool
- func (a *AppStatusHandlerMock) SetInt64Value(key string, value int64)
- func (a *AppStatusHandlerMock) SetStringValue(key string, value string)
- func (a *AppStatusHandlerMock) SetUInt64Value(key string, value uint64)
- type EpochStartNotifierStub
- func (esnm *EpochStartNotifierStub) IsInterfaceNil() bool
- func (esnm *EpochStartNotifierStub) NotifyAll(hdr data.HeaderHandler)
- func (esnm *EpochStartNotifierStub) NotifyAllPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)
- func (esnm *EpochStartNotifierStub) RegisterHandler(handler epochStart.ActionHandler)
- func (esnm *EpochStartNotifierStub) UnregisterHandler(handler epochStart.ActionHandler)
- type HasherMock
- type KeyGenMock
- func (keyGen *KeyGenMock) CheckPublicKeyValid(_ []byte) error
- func (keyGen *KeyGenMock) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)
- func (keyGen *KeyGenMock) IsInterfaceNil() bool
- func (keyGen *KeyGenMock) PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error)
- func (keyGen *KeyGenMock) PublicKeyFromByteArray(_ []byte) (crypto.PublicKey, error)
- func (keyGen *KeyGenMock) Suite() crypto.Suite
- type MarshalizerMock
- type MultipleShardsCoordinatorMock
- func (scm *MultipleShardsCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
- func (scm *MultipleShardsCoordinatorMock) ComputeId(address []byte) uint32
- func (scm *MultipleShardsCoordinatorMock) IsInterfaceNil() bool
- func (scm *MultipleShardsCoordinatorMock) NumberOfShards() uint32
- func (scm *MultipleShardsCoordinatorMock) SameShard(_, _ []byte) bool
- func (scm *MultipleShardsCoordinatorMock) SelfId() uint32
- func (scm *MultipleShardsCoordinatorMock) SetNoShards(noShards uint32)
- func (scm *MultipleShardsCoordinatorMock) SetSelfId(_ uint32) error
- type NodesSetupStub
- type PathManagerStub
- type PointMock
- func (po *PointMock) Add(_ crypto.Point) (crypto.Point, error)
- func (po *PointMock) Base() crypto.Point
- func (po *PointMock) Clone() crypto.Point
- func (po *PointMock) Equal(p crypto.Point) (bool, error)
- func (po *PointMock) GetUnderlyingObj() interface{}
- func (po *PointMock) IsInterfaceNil() bool
- func (po *PointMock) MarshalBinary() ([]byte, error)
- func (po *PointMock) Mul(s crypto.Scalar) (crypto.Point, error)
- func (po *PointMock) Neg() crypto.Point
- func (po *PointMock) Null() crypto.Point
- func (po *PointMock) Pick() (crypto.Point, error)
- func (po *PointMock) Set(_ crypto.Point) error
- func (po *PointMock) Sub(_ crypto.Point) (crypto.Point, error)
- func (po *PointMock) UnmarshalBinary(point []byte) error
- type PrivateKeyMock
- type PubkeyConverterStub
- type PublicKeyMock
- type ScalarMock
- func (sm *ScalarMock) Add(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Clone() crypto.Scalar
- func (sm *ScalarMock) Div(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Equal(_ crypto.Scalar) (bool, error)
- func (sm *ScalarMock) GetUnderlyingObj() interface{}
- func (sm *ScalarMock) Inv(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) IsInterfaceNil() bool
- func (sm *ScalarMock) MarshalBinary() ([]byte, error)
- func (sm *ScalarMock) Mul(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Neg() crypto.Scalar
- func (sm *ScalarMock) One() crypto.Scalar
- func (sm *ScalarMock) Pick() (crypto.Scalar, error)
- func (sm *ScalarMock) Set(_ crypto.Scalar) error
- func (sm *ScalarMock) SetBytes([]byte) (crypto.Scalar, error)
- func (sm *ScalarMock) SetInt64(_ int64)
- func (sm *ScalarMock) Sub(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) UnmarshalBinary(val []byte) error
- func (sm *ScalarMock) Zero() crypto.Scalar
- type Streamer
- type SuiteStub
- func (s *SuiteStub) CheckPointValid(pointBytes []byte) error
- func (s *SuiteStub) CreateKeyPair() (crypto.Scalar, crypto.Point)
- func (s *SuiteStub) CreatePoint() crypto.Point
- func (s *SuiteStub) CreatePointForScalar(scalar crypto.Scalar) (crypto.Point, error)
- func (s *SuiteStub) CreateScalar() crypto.Scalar
- func (s *SuiteStub) GetUnderlyingSuite() interface{}
- func (s *SuiteStub) IsInterfaceNil() bool
- func (s *SuiteStub) PointLen() int
- func (s *SuiteStub) RandomStream() cipher.Stream
- func (s *SuiteStub) ScalarLen() int
- func (s *SuiteStub) String() string
Constants ¶
This section is empty.
Variables ¶
var ErrMockMarshalizer = errors.New("MarshalizerMock generic error")
ErrMockMarshalizer -
Functions ¶
This section is empty.
Types ¶
type AppStatusHandlerMock ¶
type AppStatusHandlerMock struct { }
AppStatusHandlerMock -
func (*AppStatusHandlerMock) AddUint64 ¶
func (a *AppStatusHandlerMock) AddUint64(key string, val uint64)
AddUint64 -
func (*AppStatusHandlerMock) Decrement ¶
func (a *AppStatusHandlerMock) Decrement(key string)
Decrement -
func (*AppStatusHandlerMock) Increment ¶
func (a *AppStatusHandlerMock) Increment(key string)
Increment -
func (*AppStatusHandlerMock) IsInterfaceNil ¶
func (a *AppStatusHandlerMock) IsInterfaceNil() bool
IsInterfaceNil -
func (*AppStatusHandlerMock) SetInt64Value ¶
func (a *AppStatusHandlerMock) SetInt64Value(key string, value int64)
SetInt64Value -
func (*AppStatusHandlerMock) SetStringValue ¶
func (a *AppStatusHandlerMock) SetStringValue(key string, value string)
SetStringValue -
func (*AppStatusHandlerMock) SetUInt64Value ¶
func (a *AppStatusHandlerMock) SetUInt64Value(key string, value uint64)
SetUInt64Value -
type EpochStartNotifierStub ¶
type EpochStartNotifierStub struct { RegisterHandlerCalled func(handler epochStart.ActionHandler) UnregisterHandlerCalled func(handler epochStart.ActionHandler) NotifyAllPrepareCalled func(hdr data.HeaderHandler, body data.BodyHandler) NotifyAllCalled func(hdr data.HeaderHandler) }
EpochStartNotifierStub -
func (*EpochStartNotifierStub) IsInterfaceNil ¶
func (esnm *EpochStartNotifierStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*EpochStartNotifierStub) NotifyAll ¶
func (esnm *EpochStartNotifierStub) NotifyAll(hdr data.HeaderHandler)
NotifyAll -
func (*EpochStartNotifierStub) NotifyAllPrepare ¶
func (esnm *EpochStartNotifierStub) NotifyAllPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)
NotifyAllPrepare -
func (*EpochStartNotifierStub) RegisterHandler ¶
func (esnm *EpochStartNotifierStub) RegisterHandler(handler epochStart.ActionHandler)
RegisterHandler -
func (*EpochStartNotifierStub) UnregisterHandler ¶
func (esnm *EpochStartNotifierStub) UnregisterHandler(handler epochStart.ActionHandler)
UnregisterHandler -
type HasherMock ¶
type HasherMock struct { }
HasherMock that will be used for testing
func (HasherMock) Compute ¶
func (sha HasherMock) Compute(s string) []byte
Compute will output the SHA's equivalent of the input string
func (HasherMock) EmptyHash ¶
func (sha HasherMock) EmptyHash() []byte
EmptyHash will return the equivalent of empty string SHA's
func (HasherMock) IsInterfaceNil ¶
func (sha HasherMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type KeyGenMock ¶
type KeyGenMock struct { GeneratePairMock func() (crypto.PrivateKey, crypto.PublicKey) PrivateKeyFromByteArrayMock func(b []byte) (crypto.PrivateKey, error) PublicKeyFromByteArrayMock func(b []byte) (crypto.PublicKey, error) SuiteMock func() crypto.Suite }
KeyGenMock mocks a key generation implementation
func (*KeyGenMock) CheckPublicKeyValid ¶ added in v1.0.120
func (keyGen *KeyGenMock) CheckPublicKeyValid(_ []byte) error
CheckPublicKeyValid -
func (*KeyGenMock) GeneratePair ¶
func (keyGen *KeyGenMock) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)
GeneratePair generates a pair of private and public keys
func (*KeyGenMock) IsInterfaceNil ¶
func (keyGen *KeyGenMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*KeyGenMock) PrivateKeyFromByteArray ¶
func (keyGen *KeyGenMock) PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error)
PrivateKeyFromByteArray generates the private key from it's byte array representation
func (*KeyGenMock) PublicKeyFromByteArray ¶
func (keyGen *KeyGenMock) PublicKeyFromByteArray(_ []byte) (crypto.PublicKey, error)
PublicKeyFromByteArray generates a public key from it's byte array representation
type MarshalizerMock ¶
type MarshalizerMock struct {
Fail bool
}
MarshalizerMock that will be used for testing
func (MarshalizerMock) IsInterfaceNil ¶
func (mm MarshalizerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (MarshalizerMock) Marshal ¶
func (mm MarshalizerMock) Marshal(obj interface{}) ([]byte, error)
Marshal converts the input object in a slice of bytes
func (MarshalizerMock) Unmarshal ¶
func (mm MarshalizerMock) Unmarshal(obj interface{}, buff []byte) error
Unmarshal applies the serialized values over an instantiated object
type MultipleShardsCoordinatorMock ¶
type MultipleShardsCoordinatorMock struct { NoShards uint32 CurrentShard uint32 ComputeIdCalled func(address []byte) uint32 SelfIDCalled func() uint32 }
MultipleShardsCoordinatorMock -
func NewMultiShardsCoordinatorMock ¶
func NewMultiShardsCoordinatorMock(nrShard uint32) *MultipleShardsCoordinatorMock
NewMultiShardsCoordinatorMock -
func (*MultipleShardsCoordinatorMock) CommunicationIdentifier ¶
func (scm *MultipleShardsCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
CommunicationIdentifier returns the identifier between current shard ID and destination shard ID identifier is generated such as the first shard from identifier is always smaller than the last
func (*MultipleShardsCoordinatorMock) ComputeId ¶
func (scm *MultipleShardsCoordinatorMock) ComputeId(address []byte) uint32
ComputeId -
func (*MultipleShardsCoordinatorMock) IsInterfaceNil ¶
func (scm *MultipleShardsCoordinatorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MultipleShardsCoordinatorMock) NumberOfShards ¶
func (scm *MultipleShardsCoordinatorMock) NumberOfShards() uint32
NumberOfShards -
func (*MultipleShardsCoordinatorMock) SameShard ¶
func (scm *MultipleShardsCoordinatorMock) SameShard(_, _ []byte) bool
SameShard -
func (*MultipleShardsCoordinatorMock) SelfId ¶
func (scm *MultipleShardsCoordinatorMock) SelfId() uint32
SelfId -
func (*MultipleShardsCoordinatorMock) SetNoShards ¶
func (scm *MultipleShardsCoordinatorMock) SetNoShards(noShards uint32)
SetNoShards -
func (*MultipleShardsCoordinatorMock) SetSelfId ¶
func (scm *MultipleShardsCoordinatorMock) SetSelfId(_ uint32) error
SetSelfId -
type NodesSetupStub ¶
type NodesSetupStub struct { InitialNodesPubKeysCalled func() map[uint32][]string InitialEligibleNodesPubKeysForShardCalled func(shardId uint32) ([]string, error) }
NodesSetupStub -
func (*NodesSetupStub) InitialEligibleNodesPubKeysForShard ¶
func (n *NodesSetupStub) InitialEligibleNodesPubKeysForShard(shardId uint32) ([]string, error)
InitialEligibleNodesPubKeysForShard -
func (*NodesSetupStub) InitialNodesPubKeys ¶
func (n *NodesSetupStub) InitialNodesPubKeys() map[uint32][]string
InitialNodesPubKeys -
func (*NodesSetupStub) IsInterfaceNil ¶
func (n *NodesSetupStub) IsInterfaceNil() bool
IsInterfaceNil -
type PathManagerStub ¶
type PathManagerStub struct { PathForEpochCalled func(shardId string, epoch uint32, identifier string) string PathForStaticCalled func(shardId string, identifier string) string }
PathManagerStub -
func (*PathManagerStub) IsInterfaceNil ¶
func (p *PathManagerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*PathManagerStub) PathForEpoch ¶
func (p *PathManagerStub) PathForEpoch(shardId string, epoch uint32, identifier string) string
PathForEpoch -
func (*PathManagerStub) PathForStatic ¶
func (p *PathManagerStub) PathForStatic(shardId string, identifier string) string
PathForStatic -
type PointMock ¶
type PointMock struct { X int Y int GetUnderlyingObjStub func() interface{} MarshalBinaryStub func(x, y int) ([]byte, error) UnmarshalBinaryStub func([]byte) (x, y int, err error) }
PointMock represents a mock implementation for a Point
func (*PointMock) Add ¶
Add returns the result of adding receiver with Point p given as parameter, so that their scalars add homomorphically
func (*PointMock) Equal ¶
Equal tests if receiver is equal with the Point p given as parameter. Both Points need to be derived from the same Group
func (*PointMock) GetUnderlyingObj ¶
func (po *PointMock) GetUnderlyingObj() interface{}
GetUnderlyingObj returns the object the implementation wraps
func (*PointMock) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface
func (*PointMock) MarshalBinary ¶
MarshalBinary transforms the Point into a byte array
func (*PointMock) Mul ¶
Mul returns the result of multiplying receiver by the scalar s. Mock multiplies the scalar to both X and Y fields
func (*PointMock) Sub ¶
Sub returns the result of subtracting from receiver the Point p given as parameter, so that their scalars subtract homomorphically
func (*PointMock) UnmarshalBinary ¶
UnmarshalBinary recreates the Point from a byte array
type PrivateKeyMock ¶
type PrivateKeyMock struct { GeneratePublicMock func() crypto.PublicKey ToByteArrayMock func() ([]byte, error) SuiteMock func() crypto.Suite ScalarMock func() crypto.Scalar }
PrivateKeyMock mocks a private key implementation
func (*PrivateKeyMock) GeneratePublic ¶
func (privKey *PrivateKeyMock) GeneratePublic() crypto.PublicKey
GeneratePublic mocks generating a public key from the private key
func (*PrivateKeyMock) IsInterfaceNil ¶
func (privKey *PrivateKeyMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PrivateKeyMock) ToByteArray ¶
func (privKey *PrivateKeyMock) ToByteArray() ([]byte, error)
ToByteArray mocks converting the private key to a byte array
type PubkeyConverterStub ¶
type PubkeyConverterStub struct { LenCalled func() int DecodeCalled func(humanReadable string) ([]byte, error) EncodeCalled func(pkBytes []byte) string }
PubkeyConverterStub -
func (*PubkeyConverterStub) Decode ¶
func (pcs *PubkeyConverterStub) Decode(humanReadable string) ([]byte, error)
Decode -
func (*PubkeyConverterStub) Encode ¶
func (pcs *PubkeyConverterStub) Encode(pkBytes []byte) string
Encode -
func (*PubkeyConverterStub) IsInterfaceNil ¶
func (pcs *PubkeyConverterStub) IsInterfaceNil() bool
IsInterfaceNil -
type PublicKeyMock ¶
type PublicKeyMock struct { ToByteArrayMock func() ([]byte, error) SuiteMock func() crypto.Suite PointMock func() crypto.Point }
PublicKeyMock mocks a public key implementation
func (*PublicKeyMock) IsInterfaceNil ¶
func (pubKey *PublicKeyMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PublicKeyMock) ToByteArray ¶
func (pubKey *PublicKeyMock) ToByteArray() ([]byte, error)
ToByteArray mocks converting a public key to a byte array
type ScalarMock ¶
type ScalarMock struct { X int MarshalBinaryStub func(x int) ([]byte, error) UnmarshalBinaryStub func([]byte) (int, error) GetUnderlyingObjStub func() interface{} }
ScalarMock represents a mock implementation of a Scalar
func (*ScalarMock) Clone ¶
func (sm *ScalarMock) Clone() crypto.Scalar
Clone creates a new Scalar with same value as receiver
func (*ScalarMock) Div ¶
Div returns the modular division between receiver and scalar s given as parameter
func (*ScalarMock) Equal ¶
func (sm *ScalarMock) Equal(_ crypto.Scalar) (bool, error)
Equal tests if receiver is equal with the scalar s given as parameter. Both scalars need to be derived from the same Group
func (*ScalarMock) GetUnderlyingObj ¶
func (sm *ScalarMock) GetUnderlyingObj() interface{}
GetUnderlyingObj returns the object the implementation wraps
func (*ScalarMock) IsInterfaceNil ¶
func (sm *ScalarMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ScalarMock) MarshalBinary ¶
func (sm *ScalarMock) MarshalBinary() ([]byte, error)
MarshalBinary transforms the Scalar into a byte array
func (*ScalarMock) Mul ¶
Mul returns the modular product of receiver with scalar s given as parameter
func (*ScalarMock) Neg ¶
func (sm *ScalarMock) Neg() crypto.Scalar
Neg returns the modular negation of receiver
func (*ScalarMock) One ¶
func (sm *ScalarMock) One() crypto.Scalar
One returns the multiplicative identity (1)
func (*ScalarMock) Pick ¶
func (sm *ScalarMock) Pick() (crypto.Scalar, error)
Pick returns a fresh random or pseudo-random scalar For the mock set X to the original scalar.X *2
func (*ScalarMock) Set ¶
func (sm *ScalarMock) Set(_ crypto.Scalar) error
Set sets the receiver to Scalar s given as parameter
func (*ScalarMock) SetBytes ¶
func (sm *ScalarMock) SetBytes([]byte) (crypto.Scalar, error)
SetBytes sets the scalar from a byte-slice, reducing if necessary to the appropriate modulus.
func (*ScalarMock) SetInt64 ¶
func (sm *ScalarMock) SetInt64(_ int64)
SetInt64 sets the receiver to a small integer value v given as parameter
func (*ScalarMock) Sub ¶
Sub returns the modular difference between receiver and scalar s given as parameter
func (*ScalarMock) UnmarshalBinary ¶
func (sm *ScalarMock) UnmarshalBinary(val []byte) error
UnmarshalBinary recreates the Scalar from a byte array
func (*ScalarMock) Zero ¶
func (sm *ScalarMock) Zero() crypto.Scalar
Zero returns the the additive identity (0)
type Streamer ¶
type Streamer struct {
// contains filtered or unexported fields
}
Streamer -
func (*Streamer) XORKeyStream ¶
XORKeyStream -
type SuiteStub ¶
type SuiteStub struct { StringStub func() string ScalarLenStub func() int CreateScalarStub func() crypto.Scalar PointLenStub func() int CreatePointStub func() crypto.Point CreatePointForScalarStub func(scalar crypto.Scalar) (crypto.Point, error) RandomStreamStub func() cipher.Stream CreateKeyPairStub func() (crypto.Scalar, crypto.Point) IsPointValidStub func([]byte) error GetUnderlyingSuiteStub func() interface{} }
SuiteStub -
func (*SuiteStub) CheckPointValid ¶ added in v1.0.120
CheckPointValid -
func (*SuiteStub) CreateKeyPair ¶
CreateKeyPair -
func (*SuiteStub) CreatePointForScalar ¶
CreatePointForScalar -
func (*SuiteStub) GetUnderlyingSuite ¶
func (s *SuiteStub) GetUnderlyingSuite() interface{}
GetUnderlyingSuite -
func (*SuiteStub) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface