Documentation ¶
Index ¶
- Variables
- type AttachmentMetadata
- type AttachmentStorageFormat
- type BackupConstraints
- type BackupCreateConstraints
- type BackupCreateOpts
- type BackupMessage
- type BackupRestoreConstraints
- type BackupRestoreOpts
- type ChannelRestoreMode
- type ServerBackupCreate
- func (t *ServerBackupCreate) CorrespondingBotCommand_Create() string
- func (t *ServerBackupCreate) CorrespondingBotCommand_Download() string
- func (t *ServerBackupCreate) CorrespondingBotCommand_View() string
- func (t *ServerBackupCreate) Exec(l *zap.Logger, state jobstate.State, progstate jobstate.ProgressState) (*types.Output, error)
- func (t *ServerBackupCreate) Expiry() *time.Duration
- func (t *ServerBackupCreate) Fields() map[string]any
- func (t *ServerBackupCreate) LocalPresets() *interfaces.PresetInfo
- func (t *ServerBackupCreate) Name() string
- func (t *ServerBackupCreate) Owner() *types.Owner
- func (t *ServerBackupCreate) Resumable() bool
- func (t *ServerBackupCreate) Validate(state jobstate.State) error
- type ServerBackupRestore
- func (t *ServerBackupRestore) CorrespondingBotCommand_Create() string
- func (t *ServerBackupRestore) CorrespondingBotCommand_Download() string
- func (t *ServerBackupRestore) CorrespondingBotCommand_View() string
- func (t *ServerBackupRestore) Exec(l *zap.Logger, state jobstate.State, progstate jobstate.ProgressState) (*types.Output, error)
- func (t *ServerBackupRestore) Expiry() *time.Duration
- func (t *ServerBackupRestore) Fields() map[string]any
- func (t *ServerBackupRestore) LocalPresets() *interfaces.PresetInfo
- func (t *ServerBackupRestore) Name() string
- func (t *ServerBackupRestore) Owner() *types.Owner
- func (t *ServerBackupRestore) Resumable() bool
- func (t *ServerBackupRestore) Validate(state jobstate.State) error
Constants ¶
This section is empty.
Variables ¶
View Source
var FreePlanBackupConstraints = &BackupConstraints{ Create: &BackupCreateConstraints{ TotalMaxMessages: 1000, MaxAttachmentFileSize: 8_000_000, FileSizeWarningThreshold: 50_000_000, MinPerChannel: 50, DefaultPerChannel: 100, JpegReencodeQuality: 75, GuildAssetReencodeQuality: 85, }, Restore: &BackupRestoreConstraints{ RoleDeleteSleep: 1 * timex.Second, RoleCreateSleep: 2 * timex.Second, ChannelDeleteSleep: 500 * timex.Millisecond, ChannelCreateSleep: 500 * timex.Millisecond, ChannelEditSleep: 1 * timex.Second, SendMessageSleep: 350 * timex.Millisecond, HttpClientTimeout: 10 * timex.Second, MaxBodySize: 100_000_000, TotalMaxAttachmentFileSize: 25_000_000, }, MaxServerBackups: 1, FileType: "backup.server", }
Functions ¶
This section is empty.
Types ¶
type AttachmentMetadata ¶
type AttachmentMetadata struct { ID string `json:"id"` // ID of the attachment within the ticket URL string `json:"url"` // URL of the attachment ProxyURL string `json:"proxy_url"` // URL (cached) of the attachment Name string `json:"name"` // Name of the attachment ContentType string `json:"content_type"` // Content type of the attachment StorageFormat AttachmentStorageFormat `json:"storage_format"` // Storage format of the attachment Size int `json:"size"` // Size of the attachment in bytes Errors []string `json:"errors"` // Non-fatal errors that occurred while uploading the attachment }
Attachment contains metadata about an attachment
type AttachmentStorageFormat ¶
type AttachmentStorageFormat string
const ( AttachmentStorageFormatUnknownOrUnsaved AttachmentStorageFormat = "" AttachmentStorageFormatUncompressed AttachmentStorageFormat = "uncompressed" AttachmentStorageFormatGzip AttachmentStorageFormat = "gzip" AttachmentStorageFormatJpegEncoded AttachmentStorageFormat = "jpeg_encoded" AttachmentStorageFormatRemote AttachmentStorageFormat = "remote" )
type BackupConstraints ¶
type BackupConstraints struct { Create *BackupCreateConstraints Restore *BackupRestoreConstraints MaxServerBackups int // How many backup/restore jobs can run concurrently per server FileType string // The file type to use for backups }
type BackupCreateConstraints ¶
type BackupCreateConstraints struct { TotalMaxMessages int // The maximum number of messages to backup MaxAttachmentFileSize int // The maximum size of an attachment FileSizeWarningThreshold int // The warning threshold for the total file size MinPerChannel int // The minimum number of messages per channel DefaultPerChannel int // The default number of messages per channel JpegReencodeQuality int // The quality to use when reencoding to JPEGs GuildAssetReencodeQuality int // The quality to use when reencoding guild assets }
type BackupCreateOpts ¶
type BackupCreateOpts struct { Channels []string `description:"If set, the channels to prune messages from"` PerChannel int `description:"The number of messages per channel"` MaxMessages int `description:"The maximum number of messages to backup"` BackupMessages bool `description:"Whether to backup messages or not"` BackupAttachments bool `description:"Whether to backup attachments or not"` BackupGuildAssets []string `description:"What assets to back up"` IgnoreMessageBackupErrors bool `description:"Whether to ignore errors while backing up messages or not and skip these channels"` RolloverLeftovers bool `description:"Whether to attempt rollover of leftover message quota to another channels or not"` SpecialAllocations map[string]int `description:"Specific channel allocation overrides"` Encrypt string `description:"The key to encrypt backups with, if any"` }
Options that can be set when creatng a backup
type BackupMessage ¶
type BackupMessage struct { Message *discordgo.Message `json:"message"` AttachmentMetadata []AttachmentMetadata `json:"attachment_metadata"` // contains filtered or unexported fields }
Represents a backed up message
type BackupRestoreConstraints ¶
type BackupRestoreConstraints struct { RoleDeleteSleep timex.Duration // How long to sleep between role deletes RoleCreateSleep timex.Duration // How long to sleep between role creates ChannelDeleteSleep timex.Duration // How long to sleep between channel deletes ChannelCreateSleep timex.Duration // How long to sleep between channel creates ChannelEditSleep timex.Duration // How long to sleep between channel edits SendMessageSleep timex.Duration // How long to sleep between message sends HttpClientTimeout timex.Duration // How long to wait for HTTP requests to complete MaxBodySize int64 // The maximum size of the backup file to download/use TotalMaxAttachmentFileSize int // The total maximum size of all attachments }
type BackupRestoreOpts ¶
type BackupRestoreOpts struct { IgnoreRestoreErrors bool `description:"Whether to ignore errors while restoring or not and skip these channels/roles"` ProtectedChannels []string `description:"Channels to protect from being deleted"` ProtectedRoles []string `description:"Roles to protect from being deleted"` BackupSource string `description:"The source of the backup"` Decrypt string `description:"The key to decrypt backups with, if any"` ChannelRestoreMode ChannelRestoreMode `description:"Channel backup restore method. Use 'full' if unsure"` }
Options that can be set when restoring a backup
type ChannelRestoreMode ¶
type ChannelRestoreMode string
const ( ChannelRestoreModeFull ChannelRestoreMode = "full" ChannelRestoreModeDiff ChannelRestoreMode = "diff" // TODO ChannelRestoreModeIgnoreExisting ChannelRestoreMode = "ignore_existing" )
type ServerBackupCreate ¶
type ServerBackupCreate struct { // The ID of the server ServerID string // Constraints, this is auto-set by the job on jobserver and hence not configurable in this mode. Constraints *BackupConstraints // Backup options Options BackupCreateOpts }
A job to create backup a server
func (*ServerBackupCreate) CorrespondingBotCommand_Create ¶
func (t *ServerBackupCreate) CorrespondingBotCommand_Create() string
func (*ServerBackupCreate) CorrespondingBotCommand_Download ¶
func (t *ServerBackupCreate) CorrespondingBotCommand_Download() string
func (*ServerBackupCreate) CorrespondingBotCommand_View ¶
func (t *ServerBackupCreate) CorrespondingBotCommand_View() string
func (*ServerBackupCreate) Exec ¶
func (t *ServerBackupCreate) Exec( l *zap.Logger, state jobstate.State, progstate jobstate.ProgressState, ) (*types.Output, error)
func (*ServerBackupCreate) Expiry ¶
func (t *ServerBackupCreate) Expiry() *time.Duration
func (*ServerBackupCreate) Fields ¶
func (t *ServerBackupCreate) Fields() map[string]any
func (*ServerBackupCreate) LocalPresets ¶
func (t *ServerBackupCreate) LocalPresets() *interfaces.PresetInfo
func (*ServerBackupCreate) Name ¶
func (t *ServerBackupCreate) Name() string
func (*ServerBackupCreate) Owner ¶
func (t *ServerBackupCreate) Owner() *types.Owner
func (*ServerBackupCreate) Resumable ¶
func (t *ServerBackupCreate) Resumable() bool
type ServerBackupRestore ¶
type ServerBackupRestore struct { // The ID of the server ServerID string // Constraints, this is auto-set by the job in jobserver and hence not configurable in this mode. Constraints *BackupConstraints // Backup options Options BackupRestoreOpts }
A job to restore a backup of a server
func (*ServerBackupRestore) CorrespondingBotCommand_Create ¶
func (t *ServerBackupRestore) CorrespondingBotCommand_Create() string
func (*ServerBackupRestore) CorrespondingBotCommand_Download ¶
func (t *ServerBackupRestore) CorrespondingBotCommand_Download() string
func (*ServerBackupRestore) CorrespondingBotCommand_View ¶
func (t *ServerBackupRestore) CorrespondingBotCommand_View() string
func (*ServerBackupRestore) Exec ¶
func (t *ServerBackupRestore) Exec( l *zap.Logger, state jobstate.State, progstate jobstate.ProgressState, ) (*types.Output, error)
func (*ServerBackupRestore) Expiry ¶
func (t *ServerBackupRestore) Expiry() *time.Duration
func (*ServerBackupRestore) Fields ¶
func (t *ServerBackupRestore) Fields() map[string]any
func (*ServerBackupRestore) LocalPresets ¶
func (t *ServerBackupRestore) LocalPresets() *interfaces.PresetInfo
func (*ServerBackupRestore) Name ¶
func (t *ServerBackupRestore) Name() string
func (*ServerBackupRestore) Owner ¶
func (t *ServerBackupRestore) Owner() *types.Owner
func (*ServerBackupRestore) Resumable ¶
func (t *ServerBackupRestore) Resumable() bool
Click to show internal directories.
Click to hide internal directories.