Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"` // Server configuration
MemoryAllocate int `yaml:"memory_for_allocate"` // Amount of memory allocated (default 5GiB)
NumberOfWorker int `yaml:"number_of_worker"` // Number of worker threads for the server
DefaultSlab []CustomSlab `yaml:"custom_slabs"` // Default slab sizes
}
Configuration structure containing server and memory details.
func LoadConfiguration ¶
func LoadConfiguration() *Config
Function that loads configuration from a YAML file.
func NewConfig ¶
func NewConfig() *Config
Creates and returns a new instance of the `Config` structure.
func (*Config) MaxConnection ¶
Returns the maximum number of connections, ensuring it meets the minimum required value.
func (*Config) MemoryAllocator ¶
func (c *Config) MemoryAllocator() *memory_allocator.Allocator
Function that returns a memory allocator based on the `MemoryAllocate` value from the configuration.
func (*Config) NumberWorker ¶
func (*Config) Port ¶
Returns the server's port as a formatted string, using the default port if the configured port is invalid.
func (*Config) Slabs ¶
func (c *Config) Slabs(allocator *memory_allocator.Allocator) []memory_allocator.Slab
Configures and returns a list of slabs based on the current configuration and memory allocator.
type CustomSlab ¶
type CustomSlab struct {
Capacity int `yaml:"chunk_capacity"` // Capacity of each slab (in bytes)
MaxMemoryAllocate int `yaml:"max_allocate_memory"` // Maximum memory that can be allocated to the slab
}
Defines slab structures with capacities and maximum memory allocations.
func DefaultSlabs ¶
func DefaultSlabs() []CustomSlab
Returns the default slabs with predefined capacities and maximum memory allocations.
type ServerConfig ¶
type ServerConfig struct {
Port int `yaml:"port"` // Port the server listens on (default 5001)
MaxConnection int `yaml:"max_number_connection"` // Maximum number of connections to the server (default 100)
}
Server configuration structure, including port and max connection count.