Documentation
¶
Index ¶
- type EndorsedReference
- type EndorsedReferences
- type Endorsement
- type Note
- func (pt *Note) Bytes(recompute ...bool) []byte
- func (pt *Note) BytesAndID(recompute ...bool) ([]byte, util.Bytes32)
- func (pt *Note) BytesNoCache() []byte
- func (pt *Note) BytesNoSig() []byte
- func (pt *Note) DecodeMsgpack(dec *msgpack.Decoder) error
- func (pt *Note) EncodeMsgpack(enc *msgpack.Encoder) error
- func (pt *Note) GetCreatorPubKey() util.Bytes32
- func (pt *Note) GetEcoSize() uint64
- func (pt *Note) GetFee() util.String
- func (pt *Note) GetNamespace() string
- func (pt *Note) GetNodeSignature() []byte
- func (pt *Note) GetPushedReferences() PushedReferences
- func (pt *Note) GetPusherAccountNonce() uint64
- func (pt *Note) GetPusherAddress() identifier.Address
- func (pt *Note) GetPusherKeyID() []byte
- func (pt *Note) GetPusherKeyIDString() string
- func (pt *Note) GetRepoName() string
- func (pt *Note) GetSize() uint64
- func (pt *Note) GetTargetRepo() types.LocalRepo
- func (pt *Note) GetTimestamp() int64
- func (pt *Note) GetValue() util.String
- func (pt *Note) ID(recompute ...bool) util.Bytes32
- func (pt *Note) IsFromRemotePeer() bool
- func (pt *Note) Len() uint64
- func (pt *Note) SetTargetRepo(repo types.LocalRepo)
- func (pt *Note) SizeForFeeCal() uint64
- func (pt *Note) ToMap() map[string]interface{}
- func (pt *Note) TxSize() uint
- type PushEndorsement
- func (e *PushEndorsement) Bytes() []byte
- func (e *PushEndorsement) BytesAndID() ([]byte, util.Bytes32)
- func (e *PushEndorsement) BytesForBLSSig() []byte
- func (e *PushEndorsement) BytesForSig() []byte
- func (e *PushEndorsement) Clone() *PushEndorsement
- func (e *PushEndorsement) DecodeMsgpack(dec *msgpack.Decoder) error
- func (e *PushEndorsement) EncodeMsgpack(enc *msgpack.Encoder) error
- func (e *PushEndorsement) ID() util.Bytes32
- type PushNote
- type PushPool
- type PushedReference
- type PushedReferences
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EndorsedReference ¶
type EndorsedReference struct {
Hash []byte `json:"hash" msgpack:"hash,omitempty" mapstructure:"hash"`
}
EndorsedReference describes the current state of a reference endorsed by a host
type EndorsedReferences ¶
type EndorsedReferences []*EndorsedReference
EndorsedReferences is a collection of EndorsedReference
func (*EndorsedReferences) ID ¶
func (r *EndorsedReferences) ID() util.Bytes32
ID returns the id of the collection
type Endorsement ¶
type Endorsement interface { // ID returns the hash of the object ID() util.Bytes32 // Bytes returns a serialized version of the object Bytes() []byte // BytesAndID returns the serialized version of the tx and the id BytesAndID() ([]byte, util.Bytes32) }
Endorsement represents a push endorsement
type Note ¶
type Note struct { util.CodecUtil `json:"-" msgpack:"-" mapstructure:"-"` *types2.Meta `json:"-" msgpack:"-" mapstructure:"-"` // TargetRepo is the target repo local instance TargetRepo types.LocalRepo `json:",flatten,omitempty" msgpack:"-" mapstructure:"-"` // RepoName is the name of the repo. If Namespace is set, it will be the // domain pointing to the actual repository. RepoName string `json:"repo,omitempty" msgpack:"repo,omitempty"` // Namespace is the namespace which the pusher is targeting. Namespace string `json:"namespace,omitempty" msgpack:"namespace,omitempty"` // References contains all references pushed References PushedReferences `json:"references,omitempty" msgpack:"references,omitempty"` // PushKeyID is the push key ID of the pusher PushKeyID util.Bytes `json:"pusherKeyId,omitempty" msgpack:"pusherKeyId,omitempty"` // PusherAddress is the Address of the pusher PusherAddress identifier.Address `json:"pusherAddr,omitempty" msgpack:"pusherAddr,omitempty"` // Size is the size of all objects pushed Size uint64 `json:"size,omitempty" msgpack:"size,omitempty"` // Timestamp is the unix timestamp Timestamp int64 `json:"timestamp,omitempty" msgpack:"timestamp,omitempty"` // PusherAcctNonce is the next nonce of the pusher's account PusherAcctNonce uint64 `json:"accountNonce,omitempty" msgpack:"accountNonce,omitempty"` // RemoteNodeSig is the signature of the note creator RemoteNodeSig util.Bytes `json:"creatorSig,omitempty" msgpack:"creatorSig,omitempty"` // RemotePubKey is the public key of the note creator/signer CreatorPubKey util.Bytes32 `json:"creatorPubKey,omitempty" msgpack:"creatorPubKey,omitempty"` // FromPeer indicates that the note was received from a remote // peer and not created by the local node FromRemotePeer bool `json:"-" msgpack:"-"` // contains filtered or unexported fields }
PushNote implements types.PushNote
func (*Note) Bytes ¶
Bytes returns a serialized version of the object. If this function was previously called, the cached output from the previous call is returned instead of re-serializing the object. Set recompute to true to force re-serialization.
func (*Note) BytesAndID ¶
BytesAndID returns the serialized version of the tx and the id
func (*Note) BytesNoCache ¶
BytesNoCache returns the serialized version of the object but does not cache it.
func (*Note) BytesNoSig ¶
BytesNoSig returns a serialized version of the object without the signature
func (*Note) DecodeMsgpack ¶
DecodeMsgpack implements msgpack.CustomDecoder
func (*Note) EncodeMsgpack ¶
EncodeMsgpack implements msgpack.CustomEncoder
func (*Note) GetCreatorPubKey ¶
GetCreatorPubKey returns the note creator's public key
func (*Note) GetEcoSize ¶
GetEcoSize returns a size of the push note used for economics calculation.
func (*Note) GetNamespace ¶
GetNamespace returns the target namespace
func (*Note) GetNodeSignature ¶
GetNodeSignature returns the push note signature
func (*Note) GetPushedReferences ¶
func (pt *Note) GetPushedReferences() PushedReferences
GetPushedReferences returns the pushed references
func (*Note) GetPusherAccountNonce ¶
GetPusherAccountNonce returns the pusher account nonce
func (*Note) GetPusherAddress ¶
func (pt *Note) GetPusherAddress() identifier.Address
GetPusherAddress returns the pusher's address
func (*Note) GetPusherKeyID ¶
GetPusherKeyID returns the pusher pusher key ID
func (*Note) GetPusherKeyIDString ¶
GetPusherKeyIDString is like GetPusherKeyID but returns hex string, prefixed with 0x
func (*Note) GetRepoName ¶
GetRepoName returns the name of the repo receiving the push
func (*Note) GetTargetRepo ¶
GetTargetRepo returns the target repository
func (*Note) IsFromRemotePeer ¶
IsFromRemotePeer checks whether the note was sent by a remote peer
func (*Note) SetTargetRepo ¶
GetTargetRepo returns the target repository
func (*Note) SizeForFeeCal ¶
SizeForFeeCal is the size of the transaction + pushed objects
type PushEndorsement ¶
type PushEndorsement struct { util.CodecUtil `json:"-" msgpack:"-" mapstructure:"-"` // NoteID is the ID of the push note to be endorsed. NoteID util.Bytes `json:"noteID" msgpack:"noteID,omitempty" mapstructure:"noteID"` // References contains the current hash of the push references References EndorsedReferences `json:"refs" msgpack:"refs,omitempty" mapstructure:"refs"` // EndorserPubKey is the public key of the endorser EndorserPubKey util.Bytes32 `json:"pubKey" msgpack:"pubKey,omitempty" mapstructure:"pubKey"` // SigBLS is a 64 bytes BLS signature created using the BLS key of the endorser. SigBLS []byte `json:"sigBLS" msgpack:"sigBLS,omitempty" mapstructure:"sigBLS"` }
Endorsement is used to endorse a push note
func (*PushEndorsement) Bytes ¶
func (e *PushEndorsement) Bytes() []byte
Bytes returns a serialized version of the object
func (*PushEndorsement) BytesAndID ¶
func (e *PushEndorsement) BytesAndID() ([]byte, util.Bytes32)
BytesAndID returns the serialized version of the tx and the id
func (*PushEndorsement) BytesForBLSSig ¶
func (e *PushEndorsement) BytesForBLSSig() []byte
BytesForBLSSig returns the serialized version of the endorsement for creating BLS signature. It will not include the following fields: SigBLS and EndorserPubKey.
func (*PushEndorsement) BytesForSig ¶
func (e *PushEndorsement) BytesForSig() []byte
BytesForSig returns the serialized version of the endorsement for creating BLS signature. It will not include the following fields: SigBLS
func (*PushEndorsement) Clone ¶
func (e *PushEndorsement) Clone() *PushEndorsement
Clone clones the object
func (*PushEndorsement) DecodeMsgpack ¶
func (e *PushEndorsement) DecodeMsgpack(dec *msgpack.Decoder) error
DecodeMsgpack implements msgpack.CustomDecoder
func (*PushEndorsement) EncodeMsgpack ¶
func (e *PushEndorsement) EncodeMsgpack(enc *msgpack.Encoder) error
EncodeMsgpack implements msgpack.CustomEncoder
func (*PushEndorsement) ID ¶
func (e *PushEndorsement) ID() util.Bytes32
ID returns the hash of the object
type PushNote ¶
type PushNote interface { GetTargetRepo() types.LocalRepo SetTargetRepo(repo types.LocalRepo) GetPusherKeyID() []byte GetPusherAddress() identifier.Address GetPusherAccountNonce() uint64 GetPusherKeyIDString() string EncodeMsgpack(enc *msgpack.Encoder) error DecodeMsgpack(dec *msgpack.Decoder) error Bytes(recompute ...bool) []byte BytesNoCache() []byte BytesNoSig() []byte GetEcoSize() uint64 GetCreatorPubKey() util.Bytes32 GetNodeSignature() []byte GetRepoName() string GetNamespace() string GetTimestamp() int64 GetPushedReferences() PushedReferences Len() uint64 ID(recompute ...bool) util.Bytes32 BytesAndID(recompute ...bool) ([]byte, util.Bytes32) TxSize() uint SizeForFeeCal() uint64 GetSize() uint64 GetFee() util.String GetValue() util.String IsFromRemotePeer() bool GetMeta() map[string]interface{} HasMetaKey(key string) bool }
type PushPool ¶
type PushPool interface { // Register a push transaction to the pool. // // Check all the references to ensure there are no identical (same repo, // reference and nonce) references with same nonce in the pool. A valid // reference is one which has no identical reference with a higher fee rate in // the pool. If an identical reference exist in the pool with an inferior fee // rate, the existing tx holding the reference is eligible for replacable by tx // holding the reference with a superior fee rate. In cases where more than one // reference of tx is superior to multiple references in multiple transactions, // replacement will only happen if the fee rate of tx is higher than the // combined fee rate of the replaceable transactions. // // noValidation disables tx validation Add(note PushNote) error // Full returns true if the pool is full Full() bool // Get finds and returns a push note Get(noteID string) *Note // Len returns the number of items in the pool Len() int // Remove removes a push note Remove(pushNote PushNote) // HasSeen checks whether a note with the given ID was recently added HasSeen(noteID string) bool }
PushPool represents a pool for ordering git push transactions
type PushedReference ¶
type PushedReference struct { util.CodecUtil `json:"-" msgpack:"-" mapstructure:"-"` Name string `json:"name,omitempty" msgpack:"name,omitempty"` // The full name of the reference OldHash string `json:"oldHash,omitempty" msgpack:"oldHash,omitempty"` // The hash of the reference before the push NewHash string `json:"newHash,omitempty" msgpack:"newHash,omitempty"` // The hash of the reference after the push Nonce uint64 `json:"nonce,omitempty" msgpack:"nonce,omitempty"` // The next repo nonce of the reference MergeProposalID string `json:"mergeID,omitempty" msgpack:"mergeID,omitempty"` // The merge proposal ID the reference is complaint with. Fee util.String `json:"fee,omitempty" msgpack:"fee,omitempty"` // The network fee to pay for pushing the reference Value util.String `json:"value,omitempty" msgpack:"value,omitempty"` // Additional fee to pay for special operation PushSig util.Bytes `json:"pushSig,omitempty" msgpack:"pushSig,omitempty"` // The signature of from the push request token Data *types.ReferenceData `json:"data,omitempty" msgpack:"data,omitempty"` // Contains updates to the reference data }
PushedReference represents a reference that was pushed by git client
func (*PushedReference) DecodeMsgpack ¶
func (pr *PushedReference) DecodeMsgpack(dec *msgpack.Decoder) error
DecodeMsgpack implements msgpack.CustomDecoder
func (*PushedReference) EncodeMsgpack ¶
func (pr *PushedReference) EncodeMsgpack(enc *msgpack.Encoder) error
EncodeMsgpack implements msgpack.CustomEncoder
func (*PushedReference) IsDeletable ¶
func (pr *PushedReference) IsDeletable() bool
IsDeletable checks whether the pushed reference can be deleted
type PushedReferences ¶
type PushedReferences []*PushedReference
PushedReferences represents a collection of pushed references
func (*PushedReferences) GetByName ¶
func (pf *PushedReferences) GetByName(name string) *PushedReference
GetByName finds a pushed reference by name
func (*PushedReferences) Names ¶
func (pf *PushedReferences) Names() (names []string)
Names returns the names of the references