server

package
v1.5.66-0...-e3b59bf Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 70 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobStatusNew     = "new"
	JobStatusError   = "error"
	JobStatusBusy    = "busy"
	JobStatusTimeout = "timeout"

	JobStatusRetranscode      = "retranscode_preview"
	JobStatusBusyRetranscode  = "busy_retranscode_preview"
	JobStatusErrorRetranscode = "error_retranscode_preview"

	JobStatusAudioAnalysis     = "audio_analysis"
	JobStatusBusyAudioAnalysis = "busy_audio_analysis"

	JobStatusDone = "done"
)

Job statuses

View Source
const (
	StreamTrack string = "stream_track"
	ServeImage  string = "serve_image"
)

Metric actions

View Source
const (
	DelistStatusPollingInterval              = 20 * time.Second
	HTTPTimeout                              = 5 * time.Minute
	DelistBatchSize                          = 5000
	TimeFormat                               = "2006-01-02 15:04:05.999999-07"
	Tracks                      DelistEntity = "tracks"
	Users                       DelistEntity = "users"
)
View Source
const AUTO = -1
View Source
const MAX_TRIES = 3
View Source
const PercentSeededThreshold = 50
View Source
const PullLimit = 10000

Variables

This section is empty.

Functions

func ACAOHeaderOverwriteMiddleware

func ACAOHeaderOverwriteMiddleware(next echo.HandlerFunc) echo.HandlerFunc

func Resized

func Resized(ext string, read io.ReadSeeker, width, height int, mode string) (resized io.ReadSeeker, w int, h int)

Types

type AudioAnalysisResult

type AudioAnalysisResult struct {
	BPM float64 `json:"bpm"`
	Key string  `json:"key"`
}

type BlobMetric

type BlobMetric struct {
	Timestamp time.Time `json:"timestamp" gorm:"primaryKey"`
	Count     int64     `json:"count"`
}

type BlobMetrics

type BlobMetrics struct {
	Data []BlobMetric `json:"data"`
}

type ByteRange

type ByteRange struct {
	Start, End int
}

type ContactResponse

type ContactResponse struct {
	Email string `json:"email"`
}

type DailyMetrics

type DailyMetrics struct {
	Timestamp time.Time `gorm:"primaryKey"`
	Action    string    `gorm:"primaryKey"`
	Count     int64     `gorm:"not null"`
	CreatedAt time.Time `json:"created_at" gorm:"not null"`
}

type DelistEntity

type DelistEntity string

type DelistStatus

type DelistStatus struct {
	CreatedAt time.Time `json:"-"`
	Delisted  bool      `json:"delisted"`
	Reason    string    `json:"reason"`

	// fields specific to TrackDelistStatus
	TrackID  int    `json:"trackId,omitempty"`
	TrackCID string `json:"trackCid,omitempty"`
	OwnerID  int    `json:"ownerId,omitempty"`

	// field specific to UserDelistStatus
	UserID int `json:"userId,omitempty"`
}

func (*DelistStatus) UnmarshalJSON

func (ds *DelistStatus) UnmarshalJSON(data []byte) error

type FFProbeResult

type FFProbeResult struct {
	Format struct {
		Filename       string `json:"filename"`
		FormatName     string `json:"format_name"`
		FormatLongName string `json:"format_long_name"`
		Duration       string `json:"duration,omitempty"`
		Size           string `json:"size"`
		BitRate        string `json:"bit_rate,omitempty"`
	} `json:"format"`
}

type HostAttrSniff

type HostAttrSniff struct {
	Host           string
	Attr           *blob.Attributes
	RendezvousRank int
}

type HostTuple

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

type HostTuples

type HostTuples []HostTuple

func (HostTuples) Len

func (s HostTuples) Len() int

func (HostTuples) Less

func (s HostTuples) Less(i, j int) bool

func (HostTuples) Swap

func (s HostTuples) Swap(i, j int)

type JobTemplate

type JobTemplate string

Upload templates

const (
	JobTemplateAudio       JobTemplate = "audio"
	JobTemplateImgSquare   JobTemplate = "img_square"
	JobTemplateImgBackdrop JobTemplate = "img_backdrop"
)

type MediorumConfig

type MediorumConfig struct {
	Env                       string
	Self                      Peer
	Peers                     []Peer
	Signers                   []Peer
	ReplicationFactor         int
	Dir                       string `default:"/tmp/mediorum"`
	BlobStoreDSN              string `json:"-"`
	MoveFromBlobStoreDSN      string `json:"-"`
	PostgresDSN               string `json:"-"`
	PrivateKey                string `json:"-"`
	ListenPort                string
	TrustedNotifierID         int
	SPID                      int
	SPOwnerWallet             string
	GitSHA                    string
	AudiusDockerCompose       string
	AutoUpgradeEnabled        bool
	WalletIsRegistered        bool
	StoreAll                  bool
	VersionJson               VersionJson
	DiscoveryListensEndpoints []string
	CoreGRPCEndpoint          string
	CoreJRPCEndpoint          string
	// contains filtered or unexported fields
}

type MediorumServer

type MediorumServer struct {
	StartedAt time.Time
	Config    MediorumConfig
	// contains filtered or unexported fields
}

func New

func New(config MediorumConfig) (*MediorumServer, error)

func (*MediorumServer) MustStart

func (ss *MediorumServer) MustStart()

func (*MediorumServer) Stop

func (ss *MediorumServer) Stop()

type Metrics

type Metrics struct {
	Host              string         `json:"host"`
	Uploads           int64          `json:"uploads"`
	OutboxSizes       map[string]int `json:"outbox_sizes"`
	RedirectCacheSize int            `json:"redirect_cache_size"`
}

type MonthlyMetrics

type MonthlyMetrics struct {
	Timestamp time.Time `gorm:"primaryKey"`
	Action    string    `gorm:"primaryKey"`
	Count     int64     `gorm:"not null"`
	CreatedAt time.Time `json:"created_at" gorm:"not null"`
}

type Peer

type Peer struct {
	Host   string `json:"host"`
	Wallet string `json:"wallet"`
}

type PeerHealth

type PeerHealth struct {
	Version        string               `json:"version"`
	LastReachable  time.Time            `json:"lastReachable"`
	LastHealthy    time.Time            `json:"lastHealthy"`
	ReachablePeers map[string]time.Time `json:"reachablePeers"`
}

type QmAudioAnalysis

type QmAudioAnalysis struct {
	CID        string               `json:"cid" gorm:"primaryKey;column:cid"`
	Mirrors    []string             `json:"mirrors" gorm:"serializer:json"`
	Status     string               `json:"status"`
	Error      string               `json:"error,omitempty"`
	ErrorCount int                  `json:"error_count"`
	AnalyzedBy string               `json:"analyzed_by"`
	AnalyzedAt time.Time            `json:"analyzed_at"`
	Results    *AudioAnalysisResult `json:"results" gorm:"serializer:json"`
}

type RendezvousHasher

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

func NewRendezvousHasher

func NewRendezvousHasher(hosts []string) *RendezvousHasher

func (*RendezvousHasher) Rank

func (rh *RendezvousHasher) Rank(key string) []string

type RepairTracker

type RepairTracker struct {
	StartedAt      time.Time `gorm:"primaryKey;not null"`
	UpdatedAt      time.Time `gorm:"not null"`
	FinishedAt     time.Time
	CleanupMode    bool           `gorm:"not null"`
	CursorI        int            `gorm:"not null"`
	CursorUploadID string         `gorm:"not null"`
	CursorQmCID    string         `gorm:"not null"`
	Counters       map[string]int `gorm:"not null;serializer:json"`
	ContentSize    int64          `gorm:"not null"`
	Duration       time.Duration  `gorm:"not null"`
	AbortedReason  string         `gorm:"not null"`
}

type StorageAndDbSize

type StorageAndDbSize struct {
	LoggedAt         time.Time `gorm:"primaryKey;not null"`
	Host             string    `gorm:"primaryKey;not null"`
	StorageBackend   string    `gorm:"not null"`
	DbUsed           uint64    `gorm:"not null"`
	MediorumDiskUsed uint64    `gorm:"not null"`
	MediorumDiskSize uint64    `gorm:"not null"`
	LastRepairSize   int64     `gorm:"not null"`
	LastCleanupSize  int64     `gorm:"not null"`
}

type UpdateUploadBody

type UpdateUploadBody struct {
	PreviewStartSeconds string `json:"previewStartSeconds"`
}

type Upload

type Upload struct {
	ID string `json:"id"` // base32 file hash

	UserWallet        sql.NullString `json:"user_wallet"`
	Template          JobTemplate    `json:"template"`
	OrigFileName      string         `json:"orig_filename"`
	OrigFileCID       string         `json:"orig_file_cid" gorm:"column:orig_file_cid;index:idx_uploads_orig_file_cid"` //
	SelectedPreview   sql.NullString `json:"selected_preview"`
	FFProbe           *FFProbeResult `json:"probe" gorm:"serializer:json"`
	Error             string         `json:"error,omitempty"`
	ErrorCount        int            `json:"error_count,omitempty"`
	Mirrors           []string       `json:"mirrors" gorm:"serializer:json"`
	TranscodedMirrors []string       `json:"transcoded_mirrors" gorm:"serializer:json"`
	Status            string         `json:"status" gorm:"index"`
	PlacementHosts    []string       `json:"placement_hosts" gorm:"serializer:json"`

	CreatedBy string    `json:"created_by" `
	CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime:false"`
	UpdatedAt time.Time `json:"updated_at" gorm:"autoCreateTime:false"`

	TranscodedBy      string            `json:"transcoded_by"`
	TranscodeProgress float64           `json:"transcode_progress"`
	TranscodedAt      time.Time         `json:"transcoded_at"`
	TranscodeResults  map[string]string `json:"results" gorm:"serializer:json"`

	AudioAnalysisStatus     string               `json:"audio_analysis_status"`
	AudioAnalysisError      string               `json:"audio_analysis_error,omitempty"`
	AudioAnalysisErrorCount int                  `json:"audio_analysis_error_count"`
	AudioAnalyzedBy         string               `json:"audio_analyzed_by"`
	AudioAnalyzedAt         time.Time            `json:"audio_analyzed_at"`
	AudioAnalysisResults    *AudioAnalysisResult `json:"audio_analysis_results" gorm:"serializer:json"`
}

type UploadCursor

type UploadCursor struct {
	Host  string `gorm:"primaryKey"`
	After time.Time
}

type VersionJson

type VersionJson struct {
	Version string `json:"version"`
	Service string `json:"service"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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