Documentation
¶
Index ¶
- Constants
- type HealthSetter
- type LanternServer
- type LanternService
- func (s *LanternService) AddEdge(ctx context.Context, request *pb.AddEdgeRequest) (*pb.AddEdgeResponse, error)
- func (s *LanternService) DeleteEdge(ctx context.Context, in *pb.DeleteEdgeRequest) (*pb.DeleteEdgeResponse, error)
- func (s *LanternService) DeleteEdges(ctx context.Context, in *pb.DeleteEdgesRequest) (*pb.DeleteEdgesResponse, error)
- func (s *LanternService) DeleteVertex(ctx context.Context, in *pb.DeleteVertexRequest) (*pb.DeleteVertexResponse, error)
- func (s *LanternService) DeleteVertices(ctx context.Context, in *pb.DeleteVerticesRequest) (*pb.DeleteVerticesResponse, error)
- func (s *LanternService) GetEdge(ctx context.Context, request *pb.GetEdgeRequest) (*pb.GetEdgeResponse, error)
- func (s *LanternService) GetVertex(ctx context.Context, request *pb.GetVertexRequest) (*pb.GetVertexResponse, error)
- func (s *LanternService) Illuminate(ctx context.Context, request *pb.IlluminateRequest) (*pb.IlluminateResponse, error)
- func (s *LanternService) PutEdge(ctx context.Context, request *pb.PutEdgeRequest) (*pb.PutEdgeResponse, error)
- func (s *LanternService) PutVertex(ctx context.Context, request *pb.PutVertexRequest) (*pb.PutVertexResponse, error)
- type LifecycleConfig
Constants ¶
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 (s *LanternService) DeleteEdge(ctx context.Context, in *pb.DeleteEdgeRequest) (*pb.DeleteEdgeResponse, error)
func (*LanternService) DeleteEdges ¶ added in v0.5.0
func (s *LanternService) DeleteEdges(ctx context.Context, in *pb.DeleteEdgesRequest) (*pb.DeleteEdgesResponse, error)
func (*LanternService) DeleteVertex ¶ added in v0.4.0
func (s *LanternService) DeleteVertex(ctx context.Context, in *pb.DeleteVertexRequest) (*pb.DeleteVertexResponse, error)
func (*LanternService) DeleteVertices ¶ added in v0.5.0
func (s *LanternService) DeleteVertices(ctx context.Context, in *pb.DeleteVerticesRequest) (*pb.DeleteVerticesResponse, error)
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)