Help us shape the future of Go! Take the 2026 Go Developer Survey

cdn

package
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: BSD-3-Clause Imports: 53 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   sdk.RedisConf `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"`
	OrphanCleanup struct {
		Enable           bool `toml:"enable" default:"true" json:"enable" comment:"Enable orphan items cleanup for workflow v1"`
		FrequencySeconds int  `toml:"frequencySeconds" default:"60" json:"frequencySeconds" comment:"Frequency in seconds between each cleanup batch"`
		BatchSize        int  `toml:"batchSize" default:"100" json:"batchSize" comment:"Number of items to check per batch per instance"`
		GracePeriodDays  int  `` /* 143-byte string literal not displayed */
	} `` /* 131-byte string literal not displayed */
}

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