Documentation ¶
Overview ¶
Package rossby implements a distributed, encrypted message service that is intended to be geo-replicated. Rossby's goal is to facilitate the sending and receiving of messages while also ensuring that as much work as possible is pushed to the client side. Requiring clients to handle most of the encryption and message management ensures that rossby has as little detail as possible to be exposed to any security vulnerabilities.
Index ¶
- Constants
- func LogLevel() string
- func SetLogLevel(level uint8)
- func SetLogger(l *log.Logger)
- func Version(short bool) string
- type Config
- type DBLogger
- type Replica
- func (s *Replica) Authorize(ctx context.Context, in *pb.AuthorizeRequest) (*pb.AuthorizeReply, error)
- func (s *Replica) Chat(stream pb.Rossby_ChatServer) error
- func (s *Replica) Contact(ctx context.Context, in *pb.ContactRequest) (*pb.ContactReply, error)
- func (s *Replica) Deliver(ctx context.Context, in *pb.Messages) (*pb.DeliverResponse, error)
- func (s *Replica) Fetch(ctx context.Context, in *pb.FetchRequest) (*pb.Messages, error)
- func (r *Replica) Listen() error
- func (s *Replica) Register(ctx context.Context, in *pb.RegisterRequest) (*pb.RegisterReply, error)
Constants ¶
const ( LogTrace uint8 = iota LogDebug LogInfo LogCaution LogStatus LogWarn LogSilent )
Levels for implementing the debug and trace message functionality.
const CautionThreshold = 80
CautionThreshold for issuing caution logs after accumulating cautions.
Variables ¶
This section is empty.
Functions ¶
func LogLevel ¶
func LogLevel() string
LogLevel returns a string representation of the current level
func SetLogLevel ¶
func SetLogLevel(level uint8)
SetLogLevel modifies the log level for messages at runtime. Ensures that the highest level that can be set is the trace level.
Types ¶
type Config ¶
type Config struct { Address string `default:":1205"` // the host and port to bind the server to ($ROSSBY_ADDRESS) Database string `default:"fixtures/db"` // the path to the directory of the badger database ($ROSSBY_DATABASE) LogLevel int `default:"3" envconfig:"log_level"` // verbosity of logging, lower is more verbose ($ROSSBY_LOG_LEVEL) }
Config stores the optional settings that modify the behavior of rossby at runtime. A config can be created either through default values specified on the struct tags, or fetched from environment variables prefixed with ROSSBY_.
TODO: change the database default path after development TODO: allow configuration from cli context or from YAML file
func (*Config) DatabaseOptions ¶
DatabaseOptions returns the badger configuration to open and access the database.
type DBLogger ¶
type DBLogger struct{}
DBLogger implements badger.Logger to ensure database log messages get appropriately logged at the level specified by Rossby.
TODO: Generalize this structure and the rest of this package into a kansaslabs log package
type Replica ¶
type Replica struct {
// contains filtered or unexported fields
}
Replica objects contain the state to run a single rossby replica instance which manages a local database instance and handles messages from clients and peers to distribute messages across the network. There is always one replica object per Rossby process.
func New ¶
New creates a Rossby replica with the specified config or loads the config from the environment if no configuration is passed. The replica is initialized and validated once created but is not running.
func (*Replica) Authorize ¶
func (s *Replica) Authorize(ctx context.Context, in *pb.AuthorizeRequest) (*pb.AuthorizeReply, error)
Authorize implements the Rossby server interface.
func (*Replica) Chat ¶
func (s *Replica) Chat(stream pb.Rossby_ChatServer) error
Chat implements the Rossby server interface.
func (*Replica) Contact ¶
func (s *Replica) Contact(ctx context.Context, in *pb.ContactRequest) (*pb.ContactReply, error)
Contact implements the Rossby server interface.
func (*Replica) Register ¶
func (s *Replica) Register(ctx context.Context, in *pb.RegisterRequest) (*pb.RegisterReply, error)
Register implements the Rossby server interface.