cdn

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItemLogGC = 24 * 3600
)

Variables

This section is empty.

Functions

func NewRateLimiter

func NewRateLimiter(ctx context.Context, nbPerSecond float64, burst int) *rateLimiter

Types

type Configuration

type Configuration struct {
	Name               string                          `toml:"name" default:"cds-cdn" comment:"Name of this CDS CDN Service\n Enter a name to enable this service" json:"name"`
	TCP                sdk.TCPServer                   `toml:"tcp" comment:"######################\n CDS CDN TCP Configuration \n######################" json:"tcp"`
	HTTP               service.HTTPRouterConfiguration `toml:"http" comment:"######################\n CDS CDN HTTP Configuration \n######################" json:"http"`
	URL                string                          `default:"http://localhost:8089" json:"url" comment:"Private URL for communication with API"`
	PublicTCP          string                          `toml:"publicTCP" default:"localhost:8090" comment:"Public address to access to CDN TCP server" json:"public_tcp"`
	PublicTCPEnableTLS bool                            `toml:"publicTCPEnableTLS" comment:"Enable TLS on public address to access to CDN TCP server" json:"public_tcp_enable_tls"`
	PublicHTTP         string                          `toml:"publicHTTP" default:"http://localhost:8089" comment:"Public address to access to CDN HTTP server" json:"public_http"`
	Database           database.DBConfiguration        `` /* 139-byte string literal not displayed */
	Cache              struct {
		TTL     int   `toml:"ttl" default:"60" json:"ttl"`
		LruSize int64 `toml:"lruSize" default:"134217728" json:"lruSize" comment:"Redis LRU cache for logs items in bytes (default: 128MB)"`
		Redis   struct {
			Host     string `` /* 192-byte string literal not displayed */
			Password string `toml:"password" json:"-"`
			DbIndex  int    `toml:"dbindex" default:"0" json:"dbindex"`
		} `toml:"redis" json:"redis"`
	} `toml:"cache" comment:"######################\n CDN Cache Settings \n######################" json:"cache"`
	API     service.APIServiceConfiguration `toml:"api" comment:"######################\n CDS API Settings \n######################" json:"api"`
	Log     storage.LogConfig               `toml:"log" json:"log" comment:"###########################\n Log settings.\n##########################"`
	Units   storage.Configuration           `` /* 159-byte string literal not displayed */
	Metrics struct {
		Frequency int64 `toml:"frequency" default:"30" json:"frequency" comment:"each 30s, metrics are computed"`
	} `toml:"metrics" comment:"######################\n CDN Metrics Settings \n######################" json:"metrics"`
}

Configuration is the hooks configuration structure

type GetWorkerOptions

type GetWorkerOptions struct {
	NeedPrivateKey bool
}

type ItemUnitClientData

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

type Service

type Service struct {
	service.Common
	Cfg                 Configuration
	DBConnectionFactory *database.DBConnectionFactory
	Router              *api.Router
	Cache               cache.Store
	LogCache            *lru.Redis
	Mapper              *gorpmapper.Mapper
	Units               *storage.RunningStorageUnits
	WSServer            *websocketServer
	WSBroker            *websocket.Broker
	WSEventsMutex       sync.Mutex
	WSEvents            map[string]sdk.CDNWSEvent
	Metrics             struct {
		ItemSize         *stats.Int64Measure
		ItemToSyncCount  *stats.Int64Measure
		WSClients        *stats.Int64Measure
		WSEvents         *stats.Int64Measure
		ItemToDelete     *stats.Int64Measure
		ItemUnitToDelete *stats.Int64Measure
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

Service is the stuct representing a CDN µService

func New

func New() *Service

New returns a new service

func (*Service) ApplyConfiguration

func (s *Service) ApplyConfiguration(config interface{}) error

ApplyConfiguration apply an object of type CDN.Configuration after checking it

func (*Service) CheckConfiguration

func (s *Service) CheckConfiguration(config interface{}) error

CheckConfiguration checks the validity of the configuration object

func (*Service) ComputeMetrics

func (s *Service) ComputeMetrics(ctx context.Context)

func (*Service) Init

func (s *Service) Init(config interface{}) (cdsclient.ServiceConfig, error)

func (*Service) Serve

func (s *Service) Serve(c context.Context) error

Serve will start the http api server

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

func (*Service) Status

func (s *Service) Status(ctx context.Context) *sdk.MonitoringStatus

Status returns the monitoring status for this service

type SizeWriter

type SizeWriter struct {
	Size int64
}

func (*SizeWriter) Write

func (s *SizeWriter) Write(data []byte) (n int, err error)

type StoreFileOptions

type StoreFileOptions struct {
	DisableApiRunResult bool
}

type WSLine

type WSLine struct {
	Number     int64  `json:"number"`
	Value      string `json:"value"`
	Since      int64  `json:"since,omitempty"`
	ApiRefHash string `json:"api_ref_hash"`
}

Directories

Path Synopsis
nfs
s3

Jump to

Keyboard shortcuts

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