Documentation
¶
Index ¶
- Constants
- Variables
- func GlobMatch(patterns []string, fileName string) (bool, error)
- type DbFile
- type DbFileInfo
- type DbFileReader
- type DbFs
- func (d *DbFs) CreateTempSourceDir() (string, error)
- func (d *DbFs) FileHash(excludeGlob []string) (string, error)
- func (d *DbFs) Glob(pattern string) (matches []string, err error)
- func (d *DbFs) Open(name string) (fs.File, error)
- func (d *DbFs) ReadFile(name string) ([]byte, error)
- func (d *DbFs) Reset()
- func (d *DbFs) Stat(name string) (fs.FileInfo, error)
- func (d *DbFs) StatNoSpec(name string) (fs.FileInfo, error)
- func (d *DbFs) StaticFiles() []string
- type FileCache
- type FileStore
- func (f *FileStore) AddAppVersionDisk(ctx context.Context, tx types.Transaction, metadata types.AppMetadata, ...) error
- func (f *FileStore) GetAppFiles(ctx context.Context, tx types.Transaction) ([]types.AppFile, error)
- func (f *FileStore) GetAppVersion(ctx context.Context, tx types.Transaction, version int) (*types.AppVersion, error)
- func (f *FileStore) GetAppVersions(ctx context.Context, tx types.Transaction) ([]types.AppVersion, error)
- func (f *FileStore) GetFileBySha(sha string) ([]byte, string, error)
- func (f *FileStore) GetFileByShaTx(ctx context.Context, tx types.Transaction, sha string) ([]byte, string, error)
- func (f *FileStore) GetHighestVersion(ctx context.Context, tx types.Transaction, appId types.AppId) (int, error)
- func (f *FileStore) IncrementAppVersion(ctx context.Context, tx types.Transaction, metadata *types.AppMetadata) error
- func (f *FileStore) PromoteApp(ctx context.Context, tx types.Transaction, prodAppId types.AppId, ...) error
- func (f *FileStore) Reset()
- type Metadata
- func (m *Metadata) BeginTransaction(ctx context.Context) (types.Transaction, error)
- func (m *Metadata) CommitTransaction(tx types.Transaction) error
- func (m *Metadata) CreateApp(ctx context.Context, tx types.Transaction, app *types.AppEntry) error
- func (m *Metadata) CreateSync(ctx context.Context, tx types.Transaction, sync *types.SyncEntry) error
- func (m *Metadata) DeleteApp(ctx context.Context, tx types.Transaction, id types.AppId) error
- func (m *Metadata) DeleteKV(ctx context.Context, key string) error
- func (m *Metadata) DeleteSync(ctx context.Context, tx types.Transaction, id string) error
- func (m *Metadata) FetchKV(ctx context.Context, key string) (map[string]any, error)
- func (m *Metadata) FetchKVBlob(ctx context.Context, key string) ([]byte, error)
- func (m *Metadata) GetAllApps(includeInternal bool) ([]types.AppInfo, error)
- func (m *Metadata) GetApp(pathDomain types.AppPathDomain) (*types.AppEntry, error)
- func (m *Metadata) GetAppTx(ctx context.Context, tx types.Transaction, pathDomain types.AppPathDomain) (*types.AppEntry, error)
- func (m *Metadata) GetAppsForDomain(domain string) ([]string, error)
- func (m *Metadata) GetConfig() (*types.DynamicConfig, error)
- func (m *Metadata) GetLinkedApps(ctx context.Context, tx types.Transaction, mainAppId types.AppId) ([]*types.AppEntry, error)
- func (m *Metadata) GetSyncEntries(ctx context.Context, tx types.Transaction) ([]*types.SyncEntry, error)
- func (m *Metadata) GetSyncEntry(ctx context.Context, tx types.Transaction, id string) (*types.SyncEntry, error)
- func (m *Metadata) InitConfig(ctx context.Context, user string, dynamicConfig *types.DynamicConfig) error
- func (m *Metadata) NotifyAppUpdate(appPathDomains []types.AppPathDomain) error
- func (m *Metadata) NotifyConfigUpdate() error
- func (m *Metadata) RollbackTransaction(tx types.Transaction) error
- func (m *Metadata) StoreKV(ctx context.Context, key string, value map[string]any, expireAt *time.Time) error
- func (m *Metadata) StoreKVBlob(ctx context.Context, key string, value []byte, expireAt *time.Time) error
- func (m *Metadata) UpdateAppMetadata(ctx context.Context, tx types.Transaction, app *types.AppEntry) error
- func (m *Metadata) UpdateAppSettings(ctx context.Context, tx types.Transaction, app *types.AppEntry) error
- func (m *Metadata) UpdateConfig(ctx context.Context, user string, oldVersionId string, ...) error
- func (m *Metadata) UpdateKV(ctx context.Context, key string, value map[string]any) error
- func (m *Metadata) UpdateKVBlob(ctx context.Context, key string, value []byte) error
- func (m *Metadata) UpdateSourceUrl(ctx context.Context, tx types.Transaction, app *types.AppEntry) error
- func (m *Metadata) UpdateSyncStatus(ctx context.Context, tx types.Transaction, id string, ...) error
- func (m *Metadata) VersionUpgrade(config *types.ServerConfig) error
Constants ¶
View Source
const ( COMPRESSION_THRESHOLD = 0 // files above this size are stored compressed. The chi Compress middleware does not have a threshold, // so the threshold is set to zero here BROTLI_COMPRESSION_LEVEL = 9 // https://paulcalvano.com/2018-07-25-brotli-compression-how-much-will-it-reduce-your-content/ seems )
View Source
const CURRENT_DB_VERSION = 7
View Source
const CURRENT_FILE_CACHE_VERSION = 1
Variables ¶
View Source
var ErrConfigAlreadyExists = errors.New("config already exists")
View Source
var ErrConfigNotFound = errors.New("config not found")
Functions ¶
Types ¶
type DbFile ¶
type DbFile struct {
// contains filtered or unexported fields
}
type DbFileInfo ¶
type DbFileInfo struct {
// contains filtered or unexported fields
}
func (*DbFileInfo) IsDir ¶
func (fi *DbFileInfo) IsDir() bool
func (*DbFileInfo) ModTime ¶
func (fi *DbFileInfo) ModTime() time.Time
func (*DbFileInfo) Mode ¶
func (fi *DbFileInfo) Mode() fs.FileMode
func (*DbFileInfo) Name ¶
func (fi *DbFileInfo) Name() string
func (*DbFileInfo) Size ¶
func (fi *DbFileInfo) Size() int64
func (*DbFileInfo) Sys ¶
func (fi *DbFileInfo) Sys() any
type DbFileReader ¶
type DbFileReader struct {
// contains filtered or unexported fields
}
func NewDbFileReader ¶
func NewDbFileReader(compressionType string, data []byte) *DbFileReader
func (*DbFileReader) ReadCompressed ¶
func (f *DbFileReader) ReadCompressed() ([]byte, string, error)
type DbFs ¶
func (*DbFs) CreateTempSourceDir ¶
func (*DbFs) FileHash ¶
FileHash returns a hash of the file names and their corresponding sha256 hashes
func (*DbFs) StaticFiles ¶
type FileCache ¶ added in v0.14.7
func InitFileCache ¶ added in v0.14.7
func (*FileCache) GetCachedFile ¶ added in v0.14.7
func (*FileCache) VersionUpgrade ¶ added in v0.14.7
func (f *FileCache) VersionUpgrade(config *types.ServerConfig) error
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
func NewFileStore ¶
func (*FileStore) AddAppVersionDisk ¶
func (f *FileStore) AddAppVersionDisk(ctx context.Context, tx types.Transaction, metadata types.AppMetadata, checkoutDir string) error
func (*FileStore) GetAppFiles ¶
func (*FileStore) GetAppVersion ¶
func (f *FileStore) GetAppVersion(ctx context.Context, tx types.Transaction, version int) (*types.AppVersion, error)
func (*FileStore) GetAppVersions ¶
func (f *FileStore) GetAppVersions(ctx context.Context, tx types.Transaction) ([]types.AppVersion, error)
func (*FileStore) GetFileBySha ¶
func (*FileStore) GetFileByShaTx ¶
func (*FileStore) GetHighestVersion ¶
func (*FileStore) IncrementAppVersion ¶
func (f *FileStore) IncrementAppVersion(ctx context.Context, tx types.Transaction, metadata *types.AppMetadata) error
func (*FileStore) PromoteApp ¶
func (f *FileStore) PromoteApp(ctx context.Context, tx types.Transaction, prodAppId types.AppId, metadata *types.AppMetadata) error
type Metadata ¶
type Metadata struct {
*types.Logger
AppNotifyFunc func(types.AppUpdatePayload)
ConfigNotifyFunc func(types.ConfigUpdatePayload)
// contains filtered or unexported fields
}
Metadata is the metadata persistence layer
func NewMetadata ¶
NewMetadata creates a new metadata persistence layer
func (*Metadata) BeginTransaction ¶
BeginTransaction starts a new Transaction
func (*Metadata) CommitTransaction ¶
func (m *Metadata) CommitTransaction(tx types.Transaction) error
CommitTransaction commits a transaction
func (*Metadata) CreateSync ¶
func (*Metadata) DeleteSync ¶
func (*Metadata) FetchKVBlob ¶ added in v0.15.3
func (*Metadata) GetAllApps ¶
func (*Metadata) GetAppTx ¶
func (m *Metadata) GetAppTx(ctx context.Context, tx types.Transaction, pathDomain types.AppPathDomain) (*types.AppEntry, error)
func (*Metadata) GetAppsForDomain ¶
func (*Metadata) GetConfig ¶ added in v0.14.10
func (m *Metadata) GetConfig() (*types.DynamicConfig, error)
func (*Metadata) GetLinkedApps ¶
func (m *Metadata) GetLinkedApps(ctx context.Context, tx types.Transaction, mainAppId types.AppId) ([]*types.AppEntry, error)
GetLinkedApps gets all the apps linked to the given main app (staging and preview apps)
func (*Metadata) GetSyncEntries ¶
func (m *Metadata) GetSyncEntries(ctx context.Context, tx types.Transaction) ([]*types.SyncEntry, error)
GetSyncEntries gets all the sync entries for the given webhook type
func (*Metadata) GetSyncEntry ¶
func (*Metadata) InitConfig ¶ added in v0.14.10
func (*Metadata) NotifyAppUpdate ¶
func (m *Metadata) NotifyAppUpdate(appPathDomains []types.AppPathDomain) error
NotifyAppUpdate sends a notification through the postgres listener that an app has been updated
func (*Metadata) NotifyConfigUpdate ¶ added in v0.15.0
NotifyConfigUpdate sends a notification through the postgres listener that the config has been updated
func (*Metadata) RollbackTransaction ¶
func (m *Metadata) RollbackTransaction(tx types.Transaction) error
RollbackTransaction rolls back a transaction
func (*Metadata) StoreKVBlob ¶ added in v0.15.3
func (*Metadata) UpdateAppMetadata ¶
func (*Metadata) UpdateAppSettings ¶
func (*Metadata) UpdateConfig ¶ added in v0.14.10
func (*Metadata) UpdateKVBlob ¶ added in v0.15.3
func (*Metadata) UpdateSourceUrl ¶ added in v0.14.7
func (*Metadata) UpdateSyncStatus ¶
func (m *Metadata) UpdateSyncStatus(ctx context.Context, tx types.Transaction, id string, status *types.SyncJobStatus) error
func (*Metadata) VersionUpgrade ¶
func (m *Metadata) VersionUpgrade(config *types.ServerConfig) error
Click to show internal directories.
Click to hide internal directories.