Documentation
¶
Index ¶
- Constants
- Variables
- func ACAOHeaderOverwriteMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func Resized(ext string, read io.ReadSeeker, width, height int, mode string) (resized io.ReadSeeker, w int, h int)
- type AudioAnalysisResult
- type AudioPreview
- type BlobMetric
- type BlobMetrics
- type ByteRange
- type ContactResponse
- type DailyMetrics
- type DelistEntity
- type DelistStatus
- type FFProbeResult
- type FileReader
- type GeoLocation
- type GeoResult
- type HealthCheckResponse
- type HealthCheckResponseData
- type HostAttrSniff
- type HostTuple
- type HostTuples
- type JobTemplate
- type MediorumConfig
- type MediorumServer
- type Metrics
- type MonthlyMetrics
- type PeerHealth
- type PlayEvent
- type PlayEventQueue
- type QmAudioAnalysis
- type RendezvousHasher
- type RepairTracker
- type StorageAndDbSize
- type StorageService
- func (s *StorageService) GetHealth(context.Context, *connect.Request[v1.GetHealthRequest]) (*connect.Response[v1.GetHealthResponse], error)
- func (s *StorageService) GetIPData(ctx context.Context, req *connect.Request[v1.GetIPDataRequest]) (*connect.Response[v1.GetIPDataResponse], error)
- func (s *StorageService) GetRendezvousNodes(ctx context.Context, req *connect.Request[v1.GetRendezvousNodesRequest]) (*connect.Response[v1.GetRendezvousNodesResponse], error)
- func (s *StorageService) GetStatus(context.Context, *connect.Request[v1.GetStatusRequest]) (*connect.Response[v1.GetStatusResponse], error)
- func (s *StorageService) GetStreamURL(ctx context.Context, req *connect.Request[v1.GetStreamURLRequest]) (*connect.Response[v1.GetStreamURLResponse], error)
- func (s *StorageService) GetUpload(ctx context.Context, req *connect.Request[v1.GetUploadRequest]) (*connect.Response[v1.GetUploadResponse], error)
- func (s *StorageService) Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error)
- func (s *StorageService) SetMediorum(mediorum *MediorumServer)
- func (s *StorageService) StreamTrack(ctx context.Context, req *connect.Request[v1.StreamTrackRequest], ...) error
- func (s *StorageService) UploadFiles(ctx context.Context, req *connect.Request[v1.UploadFilesRequest]) (*connect.Response[v1.UploadFilesResponse], error)
- type TranscodeStats
- type UpdateUploadBody
- type Upload
- type UploadCursor
Constants ¶
View Source
const ( JobStatusNew = "new" JobStatusError = "error" JobStatusBusy = "busy" JobStatusTimeout = "timeout" 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 ¶
View Source
var ( ErrDiskFull = errors.New("disk is too full to accept new uploads") ErrInvalidTemplate = errors.New("invalid template") ErrUploadToPlacementHosts = errors.New("if placement_hosts is specified, you must upload to one of the placement_hosts") ErrAllPlacementHostsMustBeRegisteredSigners = errors.New("all placement_hosts must be registered signers") ErrInvalidPreviewStartSeconds = errors.New("invalid preview start seconds") ErrUploadProcessFailed = errors.New("upload process failed") )
Functions ¶
func ACAOHeaderOverwriteMiddleware ¶
func ACAOHeaderOverwriteMiddleware(next echo.HandlerFunc) echo.HandlerFunc
Types ¶
type AudioAnalysisResult ¶
type AudioPreview ¶
type BlobMetric ¶
type BlobMetrics ¶
type BlobMetrics struct {
Data []BlobMetric `json:"data"`
}
type ContactResponse ¶
type ContactResponse struct {
Email string `json:"email"`
}
type DailyMetrics ¶
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 FileReader ¶
type FileReader interface {
Filename() string
Open() (io.ReadCloser, error)
}
type GeoLocation ¶
type GeoLocation struct {
Country struct {
ISOCode string `maxminddb:"iso_code"`
Names map[string]string `maxminddb:"names"`
} `maxminddb:"country"`
City struct {
Names map[string]string `maxminddb:"names"`
} `maxminddb:"city"`
Location struct {
Latitude float64 `maxminddb:"latitude"`
Longitude float64 `maxminddb:"longitude"`
} `maxminddb:"location"`
Subdivisions []struct {
ISOCode string `maxminddb:"iso_code"`
Names map[string]string `maxminddb:"names"`
} `maxminddb:"subdivisions"`
}
type HealthCheckResponse ¶
type HealthCheckResponse struct {
Data HealthCheckResponseData `json:"data"`
Signer string `json:"signer"`
Signature string `json:"signature"`
Timestamp time.Time `json:"timestamp"`
}
type HealthCheckResponseData ¶
type HealthCheckResponseData struct {
Healthy bool `json:"healthy"`
Version string `json:"version"`
Service string `json:"service"` // used by registerWithDelegate()
IsSeeding bool `json:"isSeeding"`
IsAudiusdManaged bool `json:"isAudiusdManaged"`
BuiltAt string `json:"builtAt"`
StartedAt time.Time `json:"startedAt"`
SPID int `json:"spID"`
SPOwnerWallet string `json:"spOwnerWallet"`
Git string `json:"git"`
AudiusDockerCompose string `json:"audiusDockerCompose"`
MediorumPathUsed uint64 `json:"mediorumPathUsed"` // bytes
MediorumPathSize uint64 `json:"mediorumPathSize"` // bytes
StorageExpectation uint64 `json:"storageExpectation"` // bytes
DatabaseSize uint64 `json:"databaseSize"` // bytes
DbSizeErr string `json:"dbSizeErr"`
LastSuccessfulRepair RepairTracker `json:"lastSuccessfulRepair"`
LastSuccessfulCleanup RepairTracker `json:"lastSuccessfulCleanup"`
UploadsCount int64 `json:"uploadsCount"`
UploadsCountErr string `json:"uploadsCountErr"`
AutoUpgradeEnabled bool `json:"autoUpgradeEnabled"`
TrustedNotifier *ethcontracts.NotifierInfo `json:"trustedNotifier"`
Env string `json:"env"`
Self registrar.Peer `json:"self"`
WalletIsRegistered bool `json:"wallet_is_registered"`
Signers []registrar.Peer `json:"signers"`
ReplicationFactor int `json:"replicationFactor"`
Dir string `json:"dir"`
BlobStorePrefix string `json:"blobStorePrefix"`
MoveFromBlobStorePrefix string `json:"moveFromBlobStorePrefix"`
ListenPort string `json:"listenPort"`
TrustedNotifierID int `json:"trustedNotifierId"`
PeerHealths map[string]*PeerHealth `json:"peerHealths"`
UnreachablePeers []string `json:"unreachablePeers"`
FailsPeerReachability bool `json:"failsPeerReachability"`
StoreAll bool `json:"storeAll"`
IsDbLocalhost bool `json:"isDbLocalhost"`
DiskHasSpace bool `json:"diskHasSpace"`
IsDiscoveryListensEnabled bool `json:"isDiscoveryListensEnabled"`
TranscodeQueueLength int `json:"transcodeQueueLength"`
TranscodeStats *TranscodeStats `json:"transcodeStats"`
}
type HostAttrSniff ¶
type HostAttrSniff struct {
Host string
Attr *blob.Attributes
RendezvousRank int
}
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 registrar.Peer
Peers []registrar.Peer
Signers []registrar.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 version.VersionJson
DiscoveryListensEndpoints []string
LogLevel string
ProgrammableDistributionEnabled bool
// contains filtered or unexported fields
}
type MediorumServer ¶
type MediorumServer struct {
StartedAt time.Time
Config MediorumConfig
// contains filtered or unexported fields
}
func New ¶
func New(lc *lifecycle.Lifecycle, logger *zap.Logger, config MediorumConfig, provider registrar.PeerProvider, posChannel chan pos.PoSRequest, core *coreServer.CoreService) (*MediorumServer, error)
func (*MediorumServer) MustStart ¶
func (ss *MediorumServer) MustStart() error
func (*MediorumServer) Stop ¶
func (ss *MediorumServer) Stop()
type MonthlyMetrics ¶
type PeerHealth ¶
type PlayEvent ¶
type PlayEvent struct {
RowID int
UserID string
TrackID string
PlayTime time.Time
Signature string
City string
Region string
Country string
RequestSignature string
}
func (PlayEvent) MarshalLogObject ¶
func (e PlayEvent) MarshalLogObject(enc zapcore.ObjectEncoder) error
Marshal a single PlayEvent
type PlayEventQueue ¶
type PlayEventQueue struct {
// contains filtered or unexported fields
}
func NewPlayEventQueue ¶
func NewPlayEventQueue() *PlayEventQueue
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"`
CursorPreviewCID string ``
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"`
StorageExpectation uint64 `gorm:"not null;default:0"`
LastRepairSize int64 `gorm:"not null"`
LastCleanupSize int64 `gorm:"not null"`
}
type StorageService ¶
type StorageService struct {
// contains filtered or unexported fields
}
func NewStorageService ¶
func NewStorageService() *StorageService
func (*StorageService) GetHealth ¶
func (s *StorageService) GetHealth(context.Context, *connect.Request[v1.GetHealthRequest]) (*connect.Response[v1.GetHealthResponse], error)
GetHealth implements v1connect.StorageServiceHandler.
func (*StorageService) GetIPData ¶
func (s *StorageService) GetIPData(ctx context.Context, req *connect.Request[v1.GetIPDataRequest]) (*connect.Response[v1.GetIPDataResponse], error)
GetIPData implements v1connect.StorageServiceHandler.
func (*StorageService) GetRendezvousNodes ¶
func (s *StorageService) GetRendezvousNodes(ctx context.Context, req *connect.Request[v1.GetRendezvousNodesRequest]) (*connect.Response[v1.GetRendezvousNodesResponse], error)
GetRendezvousNodes implements v1connect.StorageServiceHandler.
func (*StorageService) GetStatus ¶
func (s *StorageService) GetStatus(context.Context, *connect.Request[v1.GetStatusRequest]) (*connect.Response[v1.GetStatusResponse], error)
GetStatus implements v1connect.StorageServiceHandler.
func (*StorageService) GetStreamURL ¶
func (s *StorageService) GetStreamURL(ctx context.Context, req *connect.Request[v1.GetStreamURLRequest]) (*connect.Response[v1.GetStreamURLResponse], error)
GetStreamURL implements v1connect.StorageServiceHandler.
func (*StorageService) GetUpload ¶
func (s *StorageService) GetUpload(ctx context.Context, req *connect.Request[v1.GetUploadRequest]) (*connect.Response[v1.GetUploadResponse], error)
GetUpload implements v1connect.StorageServiceHandler.
func (*StorageService) Ping ¶
func (s *StorageService) Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error)
Ping implements v1connect.StorageServiceHandler.
func (*StorageService) SetMediorum ¶
func (s *StorageService) SetMediorum(mediorum *MediorumServer)
func (*StorageService) StreamTrack ¶
func (s *StorageService) StreamTrack(ctx context.Context, req *connect.Request[v1.StreamTrackRequest], stream *connect.ServerStream[v1.StreamTrackResponse]) error
StreamTrack implements v1connect.StorageServiceHandler.
func (*StorageService) UploadFiles ¶
func (s *StorageService) UploadFiles(ctx context.Context, req *connect.Request[v1.UploadFilesRequest]) (*connect.Response[v1.UploadFilesResponse], error)
UploadFiles implements v1connect.StorageServiceHandler.
type TranscodeStats ¶
type TranscodeStats struct {
Since time.Time `db:"since"`
UploadCount int `db:"upload_count"`
MinTranscodeTime float64 `db:"min_transcode_time"`
AvgTranscodeTime float64 `db:"avg_transcode_time"`
MaxTranscodeTime float64 `db:"max_transcode_time"`
TotalTranscodeTime float64 `db:"total_transcode_time"`
TotalBytes int `db:"total_bytes"`
TranscodeRate float64 `db:"transcode_rate"`
}
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 ¶
Source Files
¶
- audio_analysis.go
- connect.go
- db.go
- delist_statuses.go
- geoip.go
- helpers.go
- id3.go
- monitor.go
- peer_health.go
- peer_req.go
- placement.go
- play_event_queue.go
- pos.go
- qm_fix_truncated.go
- qm_sync.go
- repair.go
- replicate.go
- serve_blob.go
- serve_blob_grpc.go
- serve_contact.go
- serve_crud.go
- serve_health.go
- serve_image.go
- serve_metrics.go
- serve_upload.go
- serve_upload_grpc.go
- server.go
- server_basic_auth.go
- sniff.go
- tagged_stream.go
- transcode.go
- transcode_preview.go
- transcode_stats.go
- upload_client.go
- version.go
Click to show internal directories.
Click to hide internal directories.