grpc

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWoodpeckerServer

func NewWoodpeckerServer(forge forge.Forge, 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, id string, state rpc.State) error

Done implements the rpc.Done function

func (*RPC) Extend

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

Extend implements the rpc.Extend function

func (*RPC) Init

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

Init implements the rpc.Init function

func (*RPC) Log

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

Log implements the rpc.Log function

func (*RPC) Next

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

Next implements the rpc.Next function

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

func (*RPC) Update

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

Update implements the rpc.Update function

func (*RPC) Wait

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

Wait implements the rpc.Wait function

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