grpc

package
v3.0.0-...-181f513 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCrowServer

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

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 CrowAuthServer

type CrowAuthServer struct {
	proto.UnimplementedCrowAuthServer
	// contains filtered or unexported fields
}

func NewCrowAuthServer

func NewCrowAuthServer(jwtManager *JWTManager, agentMasterToken string, store store.Store) *CrowAuthServer

func (*CrowAuthServer) Auth

type CrowServer

type CrowServer struct {
	proto.UnimplementedCrowServer
	// contains filtered or unexported fields
}

CrowServer is a grpc server implementation.

func (*CrowServer) Done

func (s *CrowServer) Done(c context.Context, req *proto.DoneRequest) (*proto.Empty, error)

func (*CrowServer) Extend

func (s *CrowServer) Extend(c context.Context, req *proto.ExtendRequest) (*proto.Empty, error)

func (*CrowServer) Init

func (s *CrowServer) Init(c context.Context, req *proto.InitRequest) (*proto.Empty, error)

func (*CrowServer) Log

func (s *CrowServer) Log(c context.Context, req *proto.LogRequest) (*proto.Empty, error)

func (*CrowServer) Next

func (*CrowServer) RegisterAgent

func (*CrowServer) ReportHealth

func (s *CrowServer) ReportHealth(c context.Context, req *proto.ReportHealthRequest) (*proto.Empty, error)

func (*CrowServer) UnregisterAgent

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

func (*CrowServer) Update

func (s *CrowServer) Update(c context.Context, req *proto.UpdateRequest) (*proto.Empty, error)

func (*CrowServer) Version

func (*CrowServer) Wait

func (s *CrowServer) Wait(c context.Context, req *proto.WaitRequest) (*proto.Empty, 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, stepUUID string, rpcLogEntries []*rpc.LogEntry) error

Log writes a log entry to the database and publishes it to the pubsub. An explicit stepUUID makes it obvious that all entries must come from the same step.

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, info rpc.AgentInfo) (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(c 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)
}

Jump to

Keyboard shortcuts

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