server

package
v0.0.0-...-0643f43 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DataDir is the root directory for all data storage (default: "./data")
	DataDir string

	// Port is the gRPC server port (default: 50051)
	Port int

	// Namespace is the default namespace for this collector (default: "shared")
	// This namespace is used for service registration and default collection creation.
	// The "system" namespace is reserved for internal collections.
	Namespace string

	// CollectorID is the unique identifier for this collector (default: random UUID7)
	// Used for distributed system coordination and service registration.
	CollectorID string

	// Logger is the logger to use (default: log.Default())
	Logger *log.Logger

	// AuthInterceptor is an optional security interceptor (default: allow all)
	AuthInterceptor grpc.UnaryServerInterceptor
}

Config holds server configuration options.

Note: The "system" namespace is reserved for internal collections:

  • system/collections - Collection metadata registry
  • system/types - Protobuf type registry
  • system/connections - Collector connections
  • system/audit - Audit log (future)
  • system/logs - System logs (structured logging to collection)

Use your own namespace for application data.

type Server

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

Server represents a fully configured Collector server with all services.

func New

func New(config Config) (*Server, error)

New creates a new Collector server with the given configuration.

func (*Server) Address

func (s *Server) Address() string

Address returns the full address the server is listening on.

func (*Server) Close

func (s *Server) Close() error

Close closes all resources. Should be called when the server is no longer needed.

func (*Server) CollectorID

func (s *Server) CollectorID() string

CollectorID returns the unique identifier for this collector.

func (*Server) Namespace

func (s *Server) Namespace() string

Namespace returns the default namespace for this collector.

func (*Server) Port

func (s *Server) Port() int

Port returns the actual port the server is listening on.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown gracefully shuts down the server.

func (*Server) Start

func (s *Server) Start() error

Start starts the server (blocks until shutdown). This is a no-op since the server is already started in New(). Use WaitForShutdown() to block until a shutdown signal is received.

func (*Server) WaitForShutdown

func (s *Server) WaitForShutdown()

WaitForShutdown blocks until a shutdown signal is received (SIGINT, SIGTERM).

Jump to

Keyboard shortcuts

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