service

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "graph.v1.LanternService"

ServiceName is the fully-qualified gRPC service name used for per-service health reporting (grpc.health.v1) and as a logical metric label.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthSetter added in v0.5.0

type HealthSetter interface {
	SetServingStatus(service string, status healthpb.HealthCheckResponse_ServingStatus)
}

HealthSetter is the narrow surface of *health.Server that LanternServer needs to publish SERVING / NOT_SERVING per service. Defined here so callers can stub it in tests.

type LanternServer

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

LanternServer ties the gRPC server, its listener, the cache GC loop, and the per-service health gauge into a single lifecycle owned by the App composition root.

func NewLanternServer

func NewLanternServer(
	service *LanternService,
	server *grpc.Server,
	listener net.Listener,
	logger *slog.Logger,
	cfg LifecycleConfig,
	hs HealthSetter,
) *LanternServer

func (*LanternServer) Run

func (s *LanternServer) Run(ctx context.Context) error

Run registers the gRPC service, marks it healthy, starts the cache GC loop, and serves until ctx is canceled. On shutdown GracefulStop drains in-flight RPCs but is bounded by ShutdownTimeout — past that, Stop forces a hard close so the process can exit.

type LanternService

type LanternService struct {
	pb.UnimplementedLanternServiceServer
	// contains filtered or unexported fields
}

LanternService implements pb.LanternServiceServer.

Per-call logging, metrics, recovery, tracing and validation are wired up via interceptors in server/provider so handlers stay focused on business logic. Handlers honor the incoming context — short paths rely on gRPC to propagate cancellation; the early ctx.Err() checks let us return a clean Canceled / DeadlineExceeded status when a client already gave up.

NOTE: the constructor keeps the concrete generic type because wire cannot synthesize type arguments for generic providers.

func NewLanternService

func NewLanternService(cache *graph.GraphCache[string, *pb.Vertex]) *LanternService

func (*LanternService) AddEdge added in v0.4.0

func (s *LanternService) AddEdge(ctx context.Context, request *pb.AddEdgeRequest) (*pb.AddEdgeResponse, error)

func (*LanternService) DeleteEdge added in v0.4.0

func (*LanternService) DeleteEdges added in v0.5.0

func (*LanternService) DeleteVertex added in v0.4.0

func (*LanternService) DeleteVertices added in v0.5.0

func (*LanternService) GetEdge

func (s *LanternService) GetEdge(ctx context.Context, request *pb.GetEdgeRequest) (*pb.GetEdgeResponse, error)

func (*LanternService) GetVertex

func (s *LanternService) GetVertex(ctx context.Context, request *pb.GetVertexRequest) (*pb.GetVertexResponse, error)

func (*LanternService) Illuminate

func (s *LanternService) Illuminate(ctx context.Context, request *pb.IlluminateRequest) (*pb.IlluminateResponse, error)

Illuminate returns a subgraph rooted at the seed, optionally optimized into a spanning or shortest-path tree.

func (*LanternService) PutEdge

func (s *LanternService) PutEdge(ctx context.Context, request *pb.PutEdgeRequest) (*pb.PutEdgeResponse, error)

func (*LanternService) PutVertex

func (s *LanternService) PutVertex(ctx context.Context, request *pb.PutVertexRequest) (*pb.PutVertexResponse, error)

type LifecycleConfig added in v0.5.0

type LifecycleConfig struct {
	GCInterval      time.Duration
	ShutdownTimeout time.Duration
}

LifecycleConfig groups the tunables wire injects into LanternServer so the constructor signature stays stable as new options are added.

Jump to

Keyboard shortcuts

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