server

package
v0.0.0-...-b29c596 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

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 (
	JobStatusNew   = "new"
	JobStatusError = "error"
	JobStatusBusy  = "busy"

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

	JobStatusDone = "done"
)
View Source
const AUTO = -1
View Source
const PercentSeededThreshold = 50
View Source
const PullLimit = 10000

Variables

This section is empty.

Functions

func Resized

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

Types

type ByteRange

type ByteRange struct {
	Start, End int
}

type ContactResponse

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

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"`
		NbStreams      int               `json:"nb_streams"`
		NbPrograms     int               `json:"nb_programs"`
		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"`
		ProbeScore     int               `json:"probe_score"`
		Tags           map[string]string `json:"tags,omitempty"`
	} `json:"format"`
}

type JobTemplate

type JobTemplate string
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
	MigrateQmCidIters    int
	// 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 Peer

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

type PeerHealth

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

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"`

	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"`
}

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