grpc

package
v2.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWoodpeckerServer

func NewWoodpeckerServer(queue queue.Queue, logger logging.Log, pubsub *pubsub.Publisher, store store.Store) proto.WoodpeckerServer

Types

type AgentTokenClaims

type AgentTokenClaims struct {
	jwt.RegisteredClaims
	AgentID int64 `json:"agent_id"`
}

UserClaims is a custom JWT claims that contains some user's information.

type Authorizer

type Authorizer struct {
	// contains filtered or unexported fields
}

func NewAuthorizer

func NewAuthorizer(jwtManager *JWTManager) *Authorizer

func (*Authorizer) StreamInterceptor

func (a *Authorizer) StreamInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*Authorizer) UnaryInterceptor

func (a *Authorizer) UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error)

type JWTManager

type JWTManager struct {
	// contains filtered or unexported fields
}

JWTManager is a JSON web token manager.

func NewJWTManager

func NewJWTManager(secretKey string) *JWTManager

NewJWTManager returns a new JWT manager.

func (*JWTManager) Generate

func (manager *JWTManager) Generate(agentID int64) (string, error)

Generate generates and signs a new token for a user.

func (*JWTManager) Verify

func (manager *JWTManager) Verify(accessToken string) (*AgentTokenClaims, error)

Verify verifies the access token string and return a user claim if the token is valid.

type RPC

type RPC struct {
	// contains filtered or unexported fields
}

func (*RPC) Done

func (s *RPC) Done(c context.Context, strWorkflowID string, state rpc.WorkflowState) error

Done marks the workflow with the given ID as done.

func (*RPC) Extend

func (s *RPC) Extend(c context.Context, workflowID string) error

Extend extends the lease for the workflow with the given ID.

func (*RPC) Init

func (s *RPC) Init(c context.Context, strWorkflowID string, state rpc.WorkflowState) error

Init implements the rpc.Init function.

func (*RPC) Log

func (s *RPC) Log(c context.Context, rpcLogEntry *rpc.LogEntry) error

Log writes a log entry to the database and publishes it to the pubsub.

func (*RPC) Next

func (s *RPC) Next(c context.Context, agentFilter rpc.Filter) (*rpc.Workflow, error)

Next blocks until it provides the next workflow to execute.

func (*RPC) RegisterAgent

func (s *RPC) RegisterAgent(ctx context.Context, platform, backend, version string, capacity int32) (int64, error)

func (*RPC) ReportHealth

func (s *RPC) ReportHealth(ctx context.Context, status string) error

func (*RPC) UnregisterAgent

func (s *RPC) UnregisterAgent(ctx context.Context) error

UnregisterAgent removes the agent from the database.

func (*RPC) Update

func (s *RPC) Update(_ context.Context, strWorkflowID string, state rpc.StepState) error

Update updates the state of a step.

func (*RPC) Wait

func (s *RPC) Wait(c context.Context, workflowID string) error

Wait blocks until the workflow with the given ID is done.

type StreamContextWrapper

type StreamContextWrapper interface {
	grpc.ServerStream
	SetContext(context.Context)
}

type WoodpeckerAuthServer

type WoodpeckerAuthServer struct {
	proto.UnimplementedWoodpeckerAuthServer
	// contains filtered or unexported fields
}

func NewWoodpeckerAuthServer

func NewWoodpeckerAuthServer(jwtManager *JWTManager, agentMasterToken string, store store.Store) *WoodpeckerAuthServer

func (*WoodpeckerAuthServer) Auth

type WoodpeckerServer

type WoodpeckerServer struct {
	proto.UnimplementedWoodpeckerServer
	// contains filtered or unexported fields
}

WoodpeckerServer is a grpc server implementation.

func (*WoodpeckerServer) Done

func (*WoodpeckerServer) Extend

func (*WoodpeckerServer) Init

func (*WoodpeckerServer) Log

func (*WoodpeckerServer) Next

func (*WoodpeckerServer) RegisterAgent

func (*WoodpeckerServer) ReportHealth

func (*WoodpeckerServer) UnregisterAgent

func (s *WoodpeckerServer) UnregisterAgent(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)

func (*WoodpeckerServer) Update

func (*WoodpeckerServer) Version

func (*WoodpeckerServer) Wait

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL