Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePushToken(v string) (*remotetypes.TxDetail, error)
- func MakeAndApplyPushTokenToRemote(repo remotetypes.LocalRepo, args *MakeAndApplyPushTokenToRemoteArgs) error
- func MakePushToken(key types.StoredKey, txDetail *remotetypes.TxDetail) string
- type AuthenticatorFunc
- type BroadcastEndorsementFunc
- type BroadcastNoteAndEndorsementFunc
- type BroadcastPushNoteFunc
- type CreateEndorsementFunc
- type CreatePushTxFunc
- type MakeAndApplyPushTokenToRemoteArgs
- type MakeAndApplyPushTokenToRemoteFunc
- type MaybeProcessPushNoteFunc
- type Peer
- type PushHandlerFunc
- type RequestContext
- type ScheduleReSyncFunc
- type Server
- func (sv *Server) Announce(objType int, repo string, hash []byte, doneCB func(error)) bool
- func (sv *Server) BroadcastMsg(ch byte, msg []byte)
- func (sv *Server) BroadcastNoteAndEndorsement(note pushtypes.PushNote) error
- func (sv *Server) Cfg() *config.AppConfig
- func (sv *Server) CheckNote(note pushtypes.PushNote) error
- func (sv *Server) GetChannels() []*p2p.ChannelDescriptor
- func (sv *Server) GetDHT() dht2.DHT
- func (sv *Server) GetFetcher() fetcher.ObjectFetcher
- func (sv *Server) GetLogic() core.Logic
- func (sv *Server) GetMempool() core.Mempool
- func (sv *Server) GetPrivateValidatorKey() *ed25519.Key
- func (sv *Server) GetPushKeyGetter() core.PushKeyGetter
- func (sv *Server) GetPushPool() pushtypes.PushPool
- func (sv *Server) GetRPCHandler() *rpc.Handler
- func (sv *Server) GetRepo(name string) (remotetypes.LocalRepo, error)
- func (sv *Server) GetRepoState(repo remotetypes.LocalRepo, options ...remotetypes.KVOption) (remotetypes.RepoRefsState, error)
- func (sv *Server) HasRepository(name string) bool
- func (sv *Server) InitRepository(name string) error
- func (sv *Server) Log() logger.Logger
- func (sv *Server) Receive(chID byte, peer p2p.Peer, msgBytes []byte)
- func (sv *Server) SetRootDir(dir string)
- func (sv *Server) Shutdown(ctx context.Context)
- func (sv *Server) Start() error
- func (sv *Server) Stop() error
- func (sv *Server) TryScheduleReSync(note pushtypes.PushNote, ref string, fromBeginning bool) error
- func (sv *Server) Wait()
Constants ¶
const ( // PushNoteReactorChannel is the channel id sending/receiving push notes PushNoteReactorChannel = byte(0x32) // PushEndReactorChannel is the channel id for sending/receiving push endorsements PushEndReactorChannel = byte(0x33) )
Variables ¶
var ( ErrPushTokenRequired = fmt.Errorf("push token must be provided") ErrMalformedToken = fmt.Errorf("malformed token") )
Functions ¶
func DecodePushToken ¶
func DecodePushToken(v string) (*remotetypes.TxDetail, error)
DecodePushToken decodes a push request token.
func MakeAndApplyPushTokenToRemote ¶
func MakeAndApplyPushTokenToRemote(repo remotetypes.LocalRepo, args *MakeAndApplyPushTokenToRemoteArgs) error
MakeAndApplyPushTokenToRemote creates and applies signed push token(s) to each remote passed to it. It applies the token(s) to the username part of one or more URLs of a remote. Note:
- The tokens are cached in the repocfg file.
- A URL can have multiple tokens for different references applied to it.
- If the target reference has an existing token, it is replaced with a new one.
- Setting args.ResetTokens will remove all existing tokens.
func MakePushToken ¶
func MakePushToken(key types.StoredKey, txDetail *remotetypes.TxDetail) string
MakePushToken creates a push request token
Types ¶
type AuthenticatorFunc ¶
type AuthenticatorFunc func( txDetails []*remotetypes.TxDetail, repo *state.Repository, namespace *state.Namespace, keepers core.Keepers, checkTxDetail validation.TxDetailChecker) (policy.EnforcerFunc, error)
AuthenticatorFunc describes a function for performing authentication. txDetails: The transaction details for pushed references repo: The target repository state. namespace: The target namespace. keepers: The application states keeper
type BroadcastEndorsementFunc ¶
type BroadcastEndorsementFunc func(endorsement pushtypes.Endorsement)
BroadcastEndorsementFunc describes a function for broadcasting endorsement
type BroadcastNoteAndEndorsementFunc ¶
BroadcastNoteAndEndorsementFunc describes a function for broadcasting a push note and an endorsement of it.
type BroadcastPushNoteFunc ¶
BroadcastPushNoteFunc describes a function for broadcasting a push note
type CreateEndorsementFunc ¶
type CreateEndorsementFunc func(validatorKey *ed25519.Key, note pushtypes.PushNote) (*pushtypes.PushEndorsement, error)
CreateEndorsementFunc describes a function for creating an endorsement for the given push note
type CreatePushTxFunc ¶
CreatePushTxFunc describes a function that takes a push note and creates a push transaction which is then added to the mempool.
type MakeAndApplyPushTokenToRemoteArgs ¶
type MakeAndApplyPushTokenToRemoteArgs struct { // TargetRemote the name of the remote to update. TargetRemote string // TxDetail is the transaction information to include in the push token. TxDetail *remotetypes.TxDetail // PushKey is the key to sign the token. PushKey types.StoredKey // ResetTokens forces removes all tokens from all URLS before updating. ResetTokens bool Stderr io.Writer }
MakeAndApplyPushTokenToRemoteArgs contains arguments for MakeAndApplyPushTokenToRemote
type MakeAndApplyPushTokenToRemoteFunc ¶
type MakeAndApplyPushTokenToRemoteFunc func(targetRepo remotetypes.LocalRepo, args *MakeAndApplyPushTokenToRemoteArgs) error
MakeAndApplyPushTokenToRemoteFunc describes a function for creating, signing and applying push tokens on a repo's remote(s)
type MaybeProcessPushNoteFunc ¶
type MaybeProcessPushNoteFunc func(note pushtypes.PushNote, txDetails []*remotetypes.TxDetail, polEnforcer policy.EnforcerFunc) error
MaybeProcessPushNoteFunc is a function for processing a push note
type Peer ¶
type Peer interface { tmservice.Service FlushStop() ID() p2p.ID // peer's cryptographic ID RemoteIP() net.IP // remote IP of the connection RemoteAddr() net.Addr // remote address of the connection IsOutbound() bool // did we dial the peer IsPersistent() bool // do we redial this peer when we disconnect CloseConn() error // close original connection NodeInfo() p2p.NodeInfo // peer's info Status() p2p.ConnectionStatus SocketAddr() *p2p.NetAddress // actual address of the socket Send(byte, []byte) bool TrySend(byte, []byte) bool Set(string, interface{}) Get(string) interface{} }
Peer is an interface representing a peer connected on a reactor.
type PushHandlerFunc ¶
type PushHandlerFunc func( targetRepo remotetypes.LocalRepo, txDetails []*remotetypes.TxDetail, enforcer policy.EnforcerFunc) push.Handler
PushHandlerFunc describes a function for creating a push handler
type RequestContext ¶
type RequestContext struct { W http.ResponseWriter R *http.Request TxDetails []*types.TxDetail PolEnforcer policy.EnforcerFunc PushHandler push.Handler Repo types.LocalRepo RepoDir string Operation string ServiceName string GitBinPath string // contains filtered or unexported fields }
RequestContext describes a request from the git remote server
type ScheduleReSyncFunc ¶
type Server ¶
type Server struct { p2p.BaseReactor // contains filtered or unexported fields }
Server implements types.Server. It provides a system for managing and service a git repositories through http and ssh protocols.
func New ¶
func New( cfg *config.AppConfig, addr string, appLogic core.Logic, dht dht2.DHT, mempool core.Mempool, nodeService nodeService.Service, blockGetter core.BlockGetter, ) *Server
New creates an instance of Server
func (*Server) BroadcastMsg ¶
BroadcastMsg broadcast messages to peers
func (*Server) BroadcastNoteAndEndorsement ¶
BroadcastNoteAndEndorsement broadcasts a push note and an endorsement of it. The node has to be a top host to broadcast an endorsement.
func (*Server) GetChannels ¶
func (sv *Server) GetChannels() []*p2p.ChannelDescriptor
GetChannels implements Reactor.
func (*Server) GetFetcher ¶
func (sv *Server) GetFetcher() fetcher.ObjectFetcher
GetFetcher returns the fetcher service
func (*Server) GetMempool ¶
GetMempool returns the transaction pool
func (*Server) GetPrivateValidatorKey ¶
GetPrivateValidatorKey implements RepositoryManager
func (*Server) GetPushKeyGetter ¶
func (sv *Server) GetPushKeyGetter() core.PushKeyGetter
GetPushKeyGetter implements RepositoryManager
func (*Server) GetPushPool ¶
GetPushPool returns the push pool
func (*Server) GetRPCHandler ¶
GetRPCHandler returns the RPC handler
func (*Server) GetRepo ¶
func (sv *Server) GetRepo(name string) (remotetypes.LocalRepo, error)
GetRepo get a local repository
func (*Server) GetRepoState ¶
func (sv *Server) GetRepoState(repo remotetypes.LocalRepo, options ...remotetypes.KVOption) (remotetypes.RepoRefsState, error)
GetRepoState implements RepositoryManager
func (*Server) HasRepository ¶
HasRepository returns true if a valid repository exist for the given name
func (*Server) InitRepository ¶
InitRepository creates a bare git repository
func (*Server) SetRootDir ¶
SetRootDir sets the directory where repositories are stored
func (*Server) TryScheduleReSync ¶
TryScheduleReSync may schedule a local reference for resynchronization if the pushed reference old state does not match the current network state of the reference