Documentation ¶
Overview ¶
Package domain is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CtxAppUrl(ctx context.Context) (string, bool)
- func CtxSessionID(ctx context.Context) (string, bool)
- func CtxWithAppData(ctx context.Context, app App) context.Context
- func CtxWithAppGetKey(ctx context.Context, commitKey AppGetKey) context.Context
- func CtxWithAppUrl(ctx context.Context, url string) context.Context
- func CtxWithAppVersionData(ctx context.Context, appVersion AppVersion) context.Context
- func CtxWithAppspaceData(ctx context.Context, appspace Appspace) context.Context
- func CtxWithAppspaceUserData(ctx context.Context, user AppspaceUser) context.Context
- func CtxWithAppspaceUserProxyID(ctx context.Context, proxyID ProxyID) context.Context
- func CtxWithAuthUserID(ctx context.Context, userID UserID) context.Context
- func CtxWithRouteConfig(ctx context.Context, routeConfig AppRoute) context.Context
- func CtxWithSessionID(ctx context.Context, sessionId string) context.Context
- type App
- type AppGetEvent
- type AppGetKey
- type AppGetMeta
- type AppID
- type AppListing
- type AppListingFetch
- type AppListingVersion
- type AppRoute
- type AppRouteOptions
- type AppRoutePath
- type AppURLData
- type AppVersion
- type AppVersionManifest
- type AppVersionUI
- type Appspace
- type AppspaceID
- type AppspaceMetaInfo
- type AppspacePausedEvent
- type AppspaceRouteAuth
- type AppspaceRouteConfig
- type AppspaceRouteHandler
- type AppspaceRouteHitEvent
- type AppspaceStatusEvent
- type AppspaceUser
- type AppspaceUserPermission
- type Authentication
- type BadRestoreZip
- type CGroupData
- type CGroupLimits
- type Contact
- type ContactID
- type Cookie
- type DB
- type DomainCheckResult
- type DomainData
- type DropID
- type ErrorCode
- type JobID
- type LogChunk
- type LogLevel
- type LoggerI
- type LoginViewData
- type ManifestAuthor
- type MetricsI
- type MigrationJob
- type MigrationJobStatus
- type MigrationStep
- type MockMetricsI
- type MockMetricsIMockRecorder
- type MockSandboxI
- func (m *MockSandboxI) AppVersion() *AppVersion
- func (m *MockSandboxI) AppspaceID() NullAppspaceID
- func (m *MockSandboxI) EXPECT() *MockSandboxIMockRecorder
- func (m *MockSandboxI) ExecFn(arg0 AppspaceRouteHandler) error
- func (m *MockSandboxI) GetTransport() http.RoundTripper
- func (m *MockSandboxI) Graceful()
- func (m *MockSandboxI) Kill()
- func (m *MockSandboxI) LastActive() time.Time
- func (m *MockSandboxI) NewTask() chan struct{}
- func (m *MockSandboxI) Operation() string
- func (m *MockSandboxI) OwnerID() UserID
- func (m *MockSandboxI) SendMessage(arg0, arg1 int, arg2 []byte) (twine.SentMessageI, error)
- func (m *MockSandboxI) Start()
- func (m *MockSandboxI) Status() SandboxStatus
- func (m *MockSandboxI) TiedUp() bool
- func (m *MockSandboxI) WaitFor(arg0 SandboxStatus)
- type MockSandboxIMockRecorder
- func (mr *MockSandboxIMockRecorder) AppVersion() *gomock.Call
- func (mr *MockSandboxIMockRecorder) AppspaceID() *gomock.Call
- func (mr *MockSandboxIMockRecorder) ExecFn(arg0 interface{}) *gomock.Call
- func (mr *MockSandboxIMockRecorder) GetTransport() *gomock.Call
- func (mr *MockSandboxIMockRecorder) Graceful() *gomock.Call
- func (mr *MockSandboxIMockRecorder) Kill() *gomock.Call
- func (mr *MockSandboxIMockRecorder) LastActive() *gomock.Call
- func (mr *MockSandboxIMockRecorder) NewTask() *gomock.Call
- func (mr *MockSandboxIMockRecorder) Operation() *gomock.Call
- func (mr *MockSandboxIMockRecorder) OwnerID() *gomock.Call
- func (mr *MockSandboxIMockRecorder) SendMessage(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockSandboxIMockRecorder) Start() *gomock.Call
- func (mr *MockSandboxIMockRecorder) Status() *gomock.Call
- func (mr *MockSandboxIMockRecorder) TiedUp() *gomock.Call
- func (mr *MockSandboxIMockRecorder) WaitFor(arg0 interface{}) *gomock.Call
- type MockStdInput
- type MockStdInputMockRecorder
- type NullAppspaceID
- type ProcessProblem
- type ProcessWarning
- type ProxyID
- type RemoteAppspace
- type ReverseServiceI
- type RuntimeConfig
- type SandboxI
- type SandboxRun
- type SandboxRunData
- type SandboxRunIDs
- type SandboxStatus
- type Settings
- type SignupViewData
- type StdInput
- type TimedToken
- type TwineService
- type TwineService2
- type TwineServiceI
- type User
- type UserID
- type UserInvitation
- type V0AppspaceLoginToken
- type V0LoginTokenRequest
- type V0LoginTokenResponse
- type Version
Constants ¶
const AppCompleteChangelogMaxSize = int64(1 << 19) // ~500+kB
const AppExtractedPackageMaxSize = int64(1 << 30)
AppExtractedPackageMaxSize is the max size that a package is allowed to inflate to. 1Gb for now.
const AppIconMaxFileSize = int64(1 << 10 * 50) // 50kb
const AppIconMinPixelSize = 160
const AppListingMaxFileSize = int64(1 << 10 * 10) // 10kb
const AppManifestMaxFileSize = int64(1 << 10 * 10) // 10kb
const AppNameMaxLength = 30
const AppShortDescriptionMaxLength = 60
const SandboxAppService = 14
SandboxAppService is the Twine service ID for querying the app for things like routes, exec fns, ..and anything else that is set in code.
const SandboxMigrateService = 13
SandboxMigrateService is the Twine service ID for appspace migration
const ZipBackupExtractedPackageMaxSize = int64(1 << 30)
ZipBackupExtractedPackageMaxSize is the max size that a backup file is allowed to inflate to. 1Gb for now.
Variables ¶
var ErrAppManifestNotFound = errors.New("app manifest dropapp.json not found")
ErrAppManifestNotFound means the application manifest (dropapp.json) file was not found
var ErrAppVersionInUse = errors.New("app version in use")
ErrAppVersionInUse indicates the operation could not be performed on the app version because something (probably an appspace) depends on it
var ErrAppspaceLockedClosed = errors.New("appspace is locked closed")
ErrAppspaceLockedClosed the operation could not beperformed because the appspace is currently closed
var ErrBadAuth = errors.New("authentication incorrect")
ErrBadAuth is returned when a user name / passwordcombintaion is incorrect
var ErrEmailExists = errors.New("email exists")
ErrEmailExists is returned when a user email already exists
var ErrLocationKeyDoesNotExist = errors.New("location key was not found on disk")
ErrLocationKeyDoesNotExist means that an attempt to open a path at a location key failed because the location key itself was not found on disk
var ErrNoRowsAffected = errors.New("no rows affected")
ErrNoRowsAffected indicates a no DB rows were affected
var ErrNoRowsInResultSet = errors.New("no rows in result set")
ErrNoRowsInResultSet indicates that no rows were found in db
var ErrStorageExceeded = errors.New("storage limit reached")
ErrStorageExceeded indicates that a storage quota has been or will be exceeded
var ErrTokenNotFound = errors.New("token not found")
ErrTokenNotFound is used when a token is ued to gain access to a process or to data. This error indicates that the token may have expired or it never existed
var ErrUniqueConstraintViolation = errors.New("unique constraint violation")
ErrUniqueConstraintViolation indicates that a unique constraint such as an index or primary key was violated
Functions ¶
func CtxSessionID ¶
CtxSessionID gets the authenticated user id from the context Second value is false if no auth user id
func CtxWithAppData ¶
CtxWithAppData sets the app data that is solely relevant to the request
func CtxWithAppGetKey ¶
CtxWithAppGetKey sets the app get key on context
func CtxWithAppUrl ¶ added in v0.13.0
CtxWithAppUrl sets the app url on context
func CtxWithAppVersionData ¶
func CtxWithAppVersionData(ctx context.Context, appVersion AppVersion) context.Context
CtxWithAppVersionData sets the app data that is solely relevant to the request
func CtxWithAppspaceData ¶
CtxWithAppspaceData sets the appspace data that is solely relevant to the request
func CtxWithAppspaceUserData ¶
func CtxWithAppspaceUserData(ctx context.Context, user AppspaceUser) context.Context
CtxWithAppspaceUserData sets the appspace data that is solely relevant to the request
func CtxWithAppspaceUserProxyID ¶
CtxWithAppspaceUserProxyID sets the appspace data that is solely relevant to the request
func CtxWithAuthUserID ¶
CtxWithAuthUserID sets the authenticated user id on the context
func CtxWithRouteConfig ¶ added in v0.13.2
CtxWithRouteConfig sets the appspace route data for the request
Types ¶
type App ¶
type App struct { OwnerID UserID `db:"owner_id" json:"owner_id"` AppID AppID `db:"app_id" json:"app_id"` Created time.Time `db:"created" json:"created_dt"` }
App represents the data structure for an App.
type AppGetEvent ¶
type AppGetEvent struct { OwnerID UserID `json:"owner_id"` Key AppGetKey `json:"key"` // Done means the entire process is finished, nothing more is going to happen. Done bool `json:"done"` // Input is non-empty string when user input is needed (like "commit", or "see warnings then continue") Input string `json:"input"` // Step is user-readable strings that give an indication of the steps taken. Step string `json:"step"` }
AppGetEvent contains updates to an app getter process
type AppGetMeta ¶
type AppGetMeta struct { Key AppGetKey `json:"key"` PrevVersion Version `json:"prev_version"` NextVersion Version `json:"next_version"` Errors []string `json:"errors"` Warnings []ProcessWarning `json:"warnings"` // VersionManifest is currently the manifest as determined by the app processing steps. VersionManifest AppVersionManifest `json:"version_manifest"` // AppID of the app if getting a new version, or of the created app if new app AppID AppID `json:"app_id"` }
AppGetMeta has app version data and any errors found in it
type AppListing ¶ added in v0.13.0
type AppListing struct { // NewURL of the app listing. // If this is non-empty the rest of the listing data is ignored NewURL string `json:"new-url,omitempty"` // Base URL for all relative paths in listing // If not specified the Base is determined from the listing URL Base string `json:"base,omitempty"` // Versions contains data for each version // The field name must match the version in the manifest Versions map[Version]AppListingVersion `json:"versions"` }
AppListing describes a set of application versions and Urls and paths for requesting additional files
type AppListingFetch ¶ added in v0.13.0
type AppListingFetch struct { // FetchDatetime is the time that the fetch was performed FetchDatetime time.Time // NotModified is true if the remote endpoint returned the Not-Modified header NotModified bool // NewURL is set if remote endpoint returns a redirect // or if listing contains NewURL NewURL string // Listing is the last successfully fetched app listing // Maybe this should not be in here? Get it separately if you actually want the listing data? Listing AppListing // ListingDatetime for HTTP cache purposes ListingDatetime time.Time // Etag of fetched listing for caching purposes Etag string // LatestVersion is the highest stable semver of all versions in listing. // I wonder if maybe latest version should be somewhere else? // It's not really "fetch"-related. It's interpretation of listing. LatestVersion Version }
AppListingFetch is the app listing along with some fetch metadata
type AppListingVersion ¶ added in v0.13.0
type AppListingVersion struct { // Manifest is relative path to the manifest JSON file Manifest string `json:"manifest"` // Package is relative path to the package file (required) Package string `json:"package"` // Changelog is relative path to the changelog text file for this version Changelog string `json:"changelog,omitempty"` // Icon is relative path of the application icon. // It should be the same file as manifest.Icon Icon string `json:"icon,omitempty"` }
AppListingVersion contains relative paths to app files for one version.
type AppRoute ¶ added in v0.13.2
type AppRoute struct { ID string `json:"id"` Method string `json:"method"` Path AppRoutePath `json:"path"` // Path is the request path to match Auth AppspaceRouteAuth `json:"auth"` Type string `json:"type"` // Type of handler: "function" or "static" for now Options AppRouteOptions `json:"options"` // Options for the route handler }
AppRoute is route config for appspace as stored with app
type AppRouteOptions ¶ added in v0.13.2
type AppRouteOptions struct { Name string `json:"name,omitempty"` // this is called "location" downstream. (but why?) Path string `json:"path,omitempty"` }
AppRouteOptions is a JSON friendly struct that describes the desired handling for the route
type AppRoutePath ¶ added in v0.13.2
type AppRoutePath struct { Path string `json:"path"` End bool `json:"end"` // End of false makes the path a wildcard /path/** }
AppRoutePath is the request path twe are seeking to match
type AppURLData ¶ added in v0.13.0
type AppURLData struct { AppID AppID `db:"app_id" json:"app_id"` // URL of the app listing JSON file // It should not need redirecting URL string `db:"url" json:"url"` // Automatic fetch of the app listing Automatic bool `db:"automatic" json:"automatic"` // Last fetch attempted Last time.Time `db:"last_dt" json:"last_dt"` // Not null, this struct can onle exist after created after inital fetch? // LastResult values: // - "ok": fetch succeeded with new listing // - "not-modified": remote returned that resource not modified // - "new-url": remote indicated there is a new url to fetch things from (details?) (But we already have a new url field in DB?) // - "error": some error happened. But would love to stash the actual error as well. LastResult string `db:"last_result" json:"last_result"` // NewURL from which the app listing should be fetched. // This is set when the original URL returns a permanent redirect // or the "new-url" field is set in the listing // and the new URL requires confirmation from the user. NewURL string `db:"new_url" json:"new_url"` // NewUrlDatetime timestamp of when the new URL was initially discovered (is this necessary?) NewUrlDatetime nulltypes.NullTime `db:"new_url_dt" json:"new_url_dt"` // ListingDatetime ListingDatetime time.Time `db:"listing_dt" json:"listing_dt"` // Etag of fetched listing for caching purposes Etag string `db:"etag"` // do we need the etag in JSON? // LatestVersion is the highest stable semver of all versions in listing. LatestVersion Version `db:"latest_version" json:"latest_version"` }
AppURLData contains all metadata related to fetching the app listing
type AppVersion ¶
type AppVersion struct { AppID AppID `db:"app_id" json:"app_id"` Version Version `db:"version" json:"version"` Schema int `db:"schema" json:"schema"` Entrypoint string `db:"entrypoint" json:"entrypoint"` Created time.Time `db:"created" json:"created"` LocationKey string `db:"location_key" json:"-"` }
AppVersion represents a set of version of an app This struct is meant for backend use, like starting a sandbox.
func CtxAppVersionData ¶
func CtxAppVersionData(ctx context.Context) (AppVersion, bool)
CtxAppVersionData gets the app data that is solely relevant to the request
type AppVersionManifest ¶ added in v0.11.0
type AppVersionManifest struct { // Name of the application. Optional. Name string `json:"name"` // L10N? Also should have omitempty? // ShortDescription is a 10-15 words used to tell prsopective users what this is does. ShortDescription string `json:"short-description"` // I18N string. // Version in semver format. Required. Version Version `json:"version"` // Entrypoint is the script that runs the app. Optional. If ommitted system will look for app.ts or app.js. Entrypoint string `json:"entrypoint"` // Schema is the verion of the appspace data schema. // This is determined automatically by the system. Schema int `json:"schema"` // Migrations is list of migrations provided by this app version Migrations []MigrationStep `json:"migrations"` // Icon is a package-relative path to an icon file to display within the installer instance UI. Icon string `json:"icon"` //AccentColor is a CSS color used to differentiate the app in the Dropserver UI AccentColor string `json:"accent-color"` // Changelog is a package-relative path to a text file that contains release notes Changelog string `json:"changelog"` // Authors Authors []ManifestAuthor `json:"authors"` // Code is the URL of the code repository Code string `json:"code"` // Website for the app Website string `json:"website"` // Funding website or site where funding situation is explained Funding string `json:"funding"` // should maybe not be a string only... // License in SPDX string form License string `json:"license"` // LicenseFile is a package-relative path to a txt file containing the license text. LicenseFile string `json:"license-file"` // Rel path to license file within package. //ReleaseDate YYYY-MM-DD of software release date. Should be set automatically by packaging code. ReleaseDate string `json:"release-date"` // date of packaging. }
type AppVersionUI ¶ added in v0.11.0
type AppVersionUI struct { AppID AppID `db:"app_id" json:"app_id"` Name string `db:"name" json:"name"` Version Version `db:"version" json:"version"` Schema int `db:"schema" json:"schema"` Created time.Time `db:"created" json:"created_dt"` ShortDescription string `db:"short_desc" json:"short_desc"` AccentColor string `db:"color" json:"color"` Authors []ManifestAuthor `json:"authors"` //maybe truncate to three authors and send number of authors too? Code string `db:"code" json:"code"` // code repo Website string `db:"website" json:"website"` Funding string `db:"funding" json:"funding"` ReleaseDate string `db:"release_date" json:"release_date"` License string `db:"license" json:"license"` }
type Appspace ¶
type Appspace struct { OwnerID UserID `db:"owner_id"` AppspaceID AppspaceID `db:"appspace_id"` AppID AppID `db:"app_id"` AppVersion Version `db:"app_version"` DropID string `db:"dropid"` DomainName string `db:"domain_name"` Created time.Time `db:"created"` Paused bool `db:"paused"` LocationKey string `db:"location_key"` }
Appspace represents the data structure for App spaces.
type AppspaceMetaInfo ¶
type AppspaceMetaInfo struct {
Schema int
}
AppspaceMetaInfo is stored in the appspace meta db and represents the current state of the appspace's data
type AppspacePausedEvent ¶
type AppspacePausedEvent struct { AppspaceID AppspaceID Paused bool }
AppspacePausedEvent is the payload for appspace paused event
type AppspaceRouteAuth ¶
type AppspaceRouteAuth struct { //Allow is either "public", "authorized" Allow string `json:"allow"` // Permission that is required to access this route // An empty string means no specifc permission needed Permission string `json:"permission"` }
AppspaceRouteAuth is a JSON friendly struct that contains description of auth paradigm for a route Will need a lot more than just type in the long run.
type AppspaceRouteConfig ¶
type AppspaceRouteConfig struct { Methods []string `json:"methods"` Path string `json:"path"` Auth AppspaceRouteAuth `json:"auth"` Handler AppspaceRouteHandler `json:"handler"` }
AppspaceRouteConfig gives necessary data to handle an appspace route
type AppspaceRouteHandler ¶
type AppspaceRouteHandler struct { Type string `json:"type"` // how can we validate that "type" is entered corrently? File string `json:"file,omitempty"` // this is called "location" downstream. (but why?) Function string `json:"function,omitempty"` Path string `json:"path,omitempty"` }
AppspaceRouteHandler is a JSON friendly struct that describes the desired handling for the route
type AppspaceRouteHitEvent ¶
type AppspaceRouteHitEvent struct { Timestamp time.Time AppspaceID AppspaceID Request *http.Request RouteConfig *AppRoute // this needs to be normalized. use generic app route, not versioned // Credentials presented by the requester // zero-values indicate credential not presented Credentials struct { ProxyID ProxyID } // Authorized: whether the route was authorized or not Authorized bool Status int }
AppspaceRouteHitEvent contains the route that was matched with the request Is this versioned or not? It would be easier if not. Or at least have basic data unversioned, and more details versioned?
type AppspaceStatusEvent ¶
type AppspaceStatusEvent struct { OwnerID UserID `json:"owner_id"` AppspaceID AppspaceID `json:"appspace_id"` Paused bool `json:"paused"` TempPaused bool `json:"temp_paused"` TempPauseReason string `json:"temp_pause_reason"` AppspaceSchema int `json:"appspace_schema"` AppVersionSchema int `json:"app_version_schema"` Problem bool `json:"problem"` // string? To hint at the problem? }
AppspaceStatusEvent indicates readiness of appspace and the reason
type AppspaceUser ¶
type AppspaceUser struct { AppspaceID AppspaceID `json:"appspace_id"` ProxyID ProxyID `json:"proxy_id"` AuthType string `json:"auth_type"` AuthID string `json:"auth_id"` DisplayName string `json:"display_name"` Avatar string `json:"avatar"` Permissions []string `json:"permissions"` Created time.Time `json:"created_dt"` LastSeen nulltypes.NullTime `json:"last_seen"` }
AppspaceUser identifies a user of an appspace Not sure we want this to have this form? Auth should be its own struct?
func CtxAppspaceUserData ¶
func CtxAppspaceUserData(ctx context.Context) (AppspaceUser, bool)
CtxAppspaceUserData gets the appspace data that is solely relevant to the request
type AppspaceUserPermission ¶
type AppspaceUserPermission struct { Key string `json:"key"` Name string `json:"name"` Description string `json:"description"` }
AppspaceUserPermission describes a permission that can be granted to a user, or via other means. The name and description are user-facing, the key is used internally.
type Authentication ¶
type Authentication struct { Authenticated bool UserID UserID AppspaceID AppspaceID ProxyID ProxyID // for appspace users (including owner) UserAccount bool // Tells whether this is for user account auth. Otherwise it's for appspace CookieID string // if there is a cookie }
Authentication provides the authenticated data for a request OK, but this is confusing when you have auth for user admin stuff and auth for appspaces Proably need to separate those out, along with separate cookie tables, etc... Thinkn about the meaning of authentication... You're either a ds-host user (user id), or an appspace user proxy id or you have an api key ...which is all fine, but it means cookies have to be tweaked as well
type BadRestoreZip ¶
BadRestoreZip provides enough data to produce user-friendly errors when an appspace data archive is unusable
type CGroupLimits ¶ added in v0.7.2
type CGroupLimits struct {
MemoryHigh int
}
CGroupLimits specifies the limits to appply to sandboxes via cgroup controllers
type Contact ¶
type Contact struct { UserID UserID `db:"user_id"` ContactID ContactID `db:"contact_id"` Name string `db:"name"` DisplayName string `db:"display_name"` Created time.Time `db:"created"` }
Contact represents a user's contact Q: where how when do we attach other props lige appspace use and auth methods?
type Cookie ¶
type Cookie struct { CookieID string `db:"cookie_id"` Expires time.Time `db:"expires"` // UserID is confusing. is it contact id in case of appspace? // what is it for owner of appspace? UserID UserID `db:"user_id"` // UserAccount indicates whether this cookie is for the user's account management UserAccount bool `db:"user_account"` // AppspaceID is the appspace that the cookie can authorize // It's mutually exclusive with UserAccount. AppspaceID AppspaceID `db:"appspace_id"` // ProxyID is for appspace users (including owner id) ProxyID ProxyID `db:"proxy_id"` // DomainName is the domain that the cookie is set to // kind of redundant but simplifies sending cookie with updated expiration DomainName string `db:"domain"` }
Cookie represents the server-side representation of a stored cookie Might be called DBCookie to differentiate from thing that came from client?
type DB ¶
DB is the global host database handler OK, but it does not need to be wrapped in a struct!
type DomainCheckResult ¶
type DomainCheckResult struct { Valid bool `json:"valid"` Available bool `json:"available"` Message string `json:"message"` }
DomainCheckResult is the result of checking for a domain and subdomain's availability and validity for a particular purpose.
type DomainData ¶
type DomainData struct { DomainName string `json:"domain_name"` UserOwned bool `json:"user_owned"` ForAppspace bool `json:"for_appspace"` AppspaceSubdomainRequired bool `json:"appspace_subdomain_required"` ForDropID bool `json:"for_dropid"` DropIDSubdomainAllowed bool `json:"dropid_subdomain_allowed"` }
DomainData tells how a domain name can be used
type DropID ¶
type DropID struct { UserID UserID `db:"user_id" json:"user_id"` Handle string `db:"handle" json:"handle" validate:"nonzero,max=100"` Domain string `db:"domain" json:"domain" validate:"nonzero,max=100"` DisplayName string `db:"display_name" json:"display_name" validate:"max=100"` Created time.Time `db:"created" json:"created_dt"` }
DropID represents a golbally unique identification a user can ue to communicate with other DropServer instances
type LogChunk ¶
type LogChunk struct { From int64 `json:"from"` To int64 `json:"to"` Content string `json:"content"` }
AppspaceLogChunk contains a part of an appspace Log as a string and the from and to bytes that this string represents in the log
type LoggerI ¶
type LoggerI interface { Log(source, message string) SubscribeStatus() (bool, <-chan bool) UnsubscribeStatus(ch <-chan bool) GetLastBytes(n int64) (LogChunk, error) SubscribeEntries(n int64) (LogChunk, <-chan string, error) UnsubscribeEntries(ch <-chan string) }
LoggerI is interface for appspace and app log
type LoginViewData ¶
LoginViewData is used to pass messages and parameters to the login page
type ManifestAuthor ¶ added in v0.11.0
type MigrationJob ¶
type MigrationJob struct { JobID JobID `db:"job_id" json:"job_id"` OwnerID UserID `db:"owner_id" json:"owner_id"` AppspaceID AppspaceID `db:"appspace_id" json:"appspace_id"` ToVersion Version `db:"to_version" json:"to_version"` Created time.Time `db:"created" json:"created"` Started nulltypes.NullTime `db:"started" json:"started"` Finished nulltypes.NullTime `db:"finished" json:"finished"` Priority bool `db:"priority" json:"priority"` Error nulltypes.NullString `db:"error" json:"error"` }
MigrationJob describes a pending or ongoing appspace migration job
type MigrationJobStatus ¶
type MigrationJobStatus int
MigrationJobStatus represents the Status of an appspace's migration to a different version including possibly a different schema
const ( // MigrationStarted means the job has started MigrationStarted MigrationJobStatus = iota + 1 // MigrationRunning means the migration sandbox is running and migrating schemas MigrationRunning // MigrationFinished means the migration is complete or ended with an error MigrationFinished )
type MigrationStep ¶
migration data comign from sandbox: this should also include description as string. Maybe an explicit "lossy" flag? Or Lossless so taht default false doesn't imply things that aren't true.
type MockMetricsI ¶
type MockMetricsI struct {
// contains filtered or unexported fields
}
MockMetricsI is a mock of MetricsI interface
func NewMockMetricsI ¶
func NewMockMetricsI(ctrl *gomock.Controller) *MockMetricsI
NewMockMetricsI creates a new mock instance
func (*MockMetricsI) EXPECT ¶
func (m *MockMetricsI) EXPECT() *MockMetricsIMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockMetricsI) HostHandleReq ¶
func (m *MockMetricsI) HostHandleReq(arg0 time.Time)
HostHandleReq mocks base method
type MockMetricsIMockRecorder ¶
type MockMetricsIMockRecorder struct {
// contains filtered or unexported fields
}
MockMetricsIMockRecorder is the mock recorder for MockMetricsI
func (*MockMetricsIMockRecorder) HostHandleReq ¶
func (mr *MockMetricsIMockRecorder) HostHandleReq(arg0 interface{}) *gomock.Call
HostHandleReq indicates an expected call of HostHandleReq
type MockSandboxI ¶
type MockSandboxI struct {
// contains filtered or unexported fields
}
MockSandboxI is a mock of SandboxI interface
func NewMockSandboxI ¶
func NewMockSandboxI(ctrl *gomock.Controller) *MockSandboxI
NewMockSandboxI creates a new mock instance
func (*MockSandboxI) AppVersion ¶
func (m *MockSandboxI) AppVersion() *AppVersion
AppVersion mocks base method
func (*MockSandboxI) AppspaceID ¶
func (m *MockSandboxI) AppspaceID() NullAppspaceID
AppspaceID mocks base method
func (*MockSandboxI) EXPECT ¶
func (m *MockSandboxI) EXPECT() *MockSandboxIMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockSandboxI) ExecFn ¶
func (m *MockSandboxI) ExecFn(arg0 AppspaceRouteHandler) error
ExecFn mocks base method
func (*MockSandboxI) GetTransport ¶
func (m *MockSandboxI) GetTransport() http.RoundTripper
GetTransport mocks base method
func (*MockSandboxI) LastActive ¶
func (m *MockSandboxI) LastActive() time.Time
LastActive mocks base method
func (*MockSandboxI) NewTask ¶
func (m *MockSandboxI) NewTask() chan struct{}
NewTask mocks base method
func (*MockSandboxI) Operation ¶
func (m *MockSandboxI) Operation() string
Operation mocks base method
func (*MockSandboxI) SendMessage ¶
func (m *MockSandboxI) SendMessage(arg0, arg1 int, arg2 []byte) (twine.SentMessageI, error)
SendMessage mocks base method
func (*MockSandboxI) Status ¶
func (m *MockSandboxI) Status() SandboxStatus
Status mocks base method
func (*MockSandboxI) WaitFor ¶
func (m *MockSandboxI) WaitFor(arg0 SandboxStatus)
WaitFor mocks base method
type MockSandboxIMockRecorder ¶
type MockSandboxIMockRecorder struct {
// contains filtered or unexported fields
}
MockSandboxIMockRecorder is the mock recorder for MockSandboxI
func (*MockSandboxIMockRecorder) AppVersion ¶
func (mr *MockSandboxIMockRecorder) AppVersion() *gomock.Call
AppVersion indicates an expected call of AppVersion
func (*MockSandboxIMockRecorder) AppspaceID ¶
func (mr *MockSandboxIMockRecorder) AppspaceID() *gomock.Call
AppspaceID indicates an expected call of AppspaceID
func (*MockSandboxIMockRecorder) ExecFn ¶
func (mr *MockSandboxIMockRecorder) ExecFn(arg0 interface{}) *gomock.Call
ExecFn indicates an expected call of ExecFn
func (*MockSandboxIMockRecorder) GetTransport ¶
func (mr *MockSandboxIMockRecorder) GetTransport() *gomock.Call
GetTransport indicates an expected call of GetTransport
func (*MockSandboxIMockRecorder) Graceful ¶
func (mr *MockSandboxIMockRecorder) Graceful() *gomock.Call
Graceful indicates an expected call of Graceful
func (*MockSandboxIMockRecorder) Kill ¶
func (mr *MockSandboxIMockRecorder) Kill() *gomock.Call
Kill indicates an expected call of Kill
func (*MockSandboxIMockRecorder) LastActive ¶
func (mr *MockSandboxIMockRecorder) LastActive() *gomock.Call
LastActive indicates an expected call of LastActive
func (*MockSandboxIMockRecorder) NewTask ¶
func (mr *MockSandboxIMockRecorder) NewTask() *gomock.Call
NewTask indicates an expected call of NewTask
func (*MockSandboxIMockRecorder) Operation ¶
func (mr *MockSandboxIMockRecorder) Operation() *gomock.Call
Operation indicates an expected call of Operation
func (*MockSandboxIMockRecorder) OwnerID ¶
func (mr *MockSandboxIMockRecorder) OwnerID() *gomock.Call
OwnerID indicates an expected call of OwnerID
func (*MockSandboxIMockRecorder) SendMessage ¶
func (mr *MockSandboxIMockRecorder) SendMessage(arg0, arg1, arg2 interface{}) *gomock.Call
SendMessage indicates an expected call of SendMessage
func (*MockSandboxIMockRecorder) Start ¶
func (mr *MockSandboxIMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start
func (*MockSandboxIMockRecorder) Status ¶
func (mr *MockSandboxIMockRecorder) Status() *gomock.Call
Status indicates an expected call of Status
func (*MockSandboxIMockRecorder) TiedUp ¶
func (mr *MockSandboxIMockRecorder) TiedUp() *gomock.Call
TiedUp indicates an expected call of TiedUp
func (*MockSandboxIMockRecorder) WaitFor ¶
func (mr *MockSandboxIMockRecorder) WaitFor(arg0 interface{}) *gomock.Call
WaitFor indicates an expected call of WaitFor
type MockStdInput ¶
type MockStdInput struct {
// contains filtered or unexported fields
}
MockStdInput is a mock of StdInput interface
func NewMockStdInput ¶
func NewMockStdInput(ctrl *gomock.Controller) *MockStdInput
NewMockStdInput creates a new mock instance
func (*MockStdInput) EXPECT ¶
func (m *MockStdInput) EXPECT() *MockStdInputMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockStdInput) ReadLine ¶
func (m *MockStdInput) ReadLine(arg0 string) string
ReadLine mocks base method
type MockStdInputMockRecorder ¶
type MockStdInputMockRecorder struct {
// contains filtered or unexported fields
}
MockStdInputMockRecorder is the mock recorder for MockStdInput
func (*MockStdInputMockRecorder) ReadLine ¶
func (mr *MockStdInputMockRecorder) ReadLine(arg0 interface{}) *gomock.Call
ReadLine indicates an expected call of ReadLine
type NullAppspaceID ¶
NullString is an alias for mysql.NullTime data type
func NewNullAppspaceID ¶
func NewNullAppspaceID(a ...AppspaceID) (ret NullAppspaceID)
NewString creates a new Time.
func (NullAppspaceID) Equal ¶
func (n NullAppspaceID) Equal(c NullAppspaceID) bool
func (*NullAppspaceID) Get ¶
func (n *NullAppspaceID) Get() (AppspaceID, bool)
func (*NullAppspaceID) MarshalJSON ¶
func (n *NullAppspaceID) MarshalJSON() ([]byte, error)
MarshalJSON for NullAppspaceID
func (*NullAppspaceID) Set ¶
func (n *NullAppspaceID) Set(a AppspaceID)
SetString sets valid to tru and sets string field
func (*NullAppspaceID) Unset ¶
func (n *NullAppspaceID) Unset()
SetNull sets the Valied filed to fals and zeros the string
type ProcessProblem ¶ added in v0.13.0
type ProcessProblem string
ProcessProblem are consts that enable checking for a specific type of problem at processing time.
const ProblemBig ProcessProblem = "big"
const ProblemEmpty ProcessProblem = "empty"
const ProblemError ProcessProblem = "error"
ProblemError implies an error took place while processing
const ProblemInvalid ProcessProblem = "invalid"
const ProblemNotFound ProcessProblem = "not-found"
const ProblemPoorExperience ProcessProblem = "poor-experience"
ProblemPoorExperience indicate the value is usable but does not meet best practices and affects the user's experience
const ProblemSmall ProcessProblem = "small" // maybe roll this into poor experience
type ProcessWarning ¶ added in v0.13.0
type ProcessWarning struct { Field string `json:"field"` // Field indicates area of problem. It can be the json key from manifest or something else Problem ProcessProblem `json:"problem"` // Problem for classification BadValue string `json:"bad_value"` // BadValue of field for safe display Message string `json:"message"` // Message for user or developer }
type RemoteAppspace ¶
type ReverseServiceI ¶
type ReverseServiceI interface {
HandleMessage(twine.ReceivedMessageI)
}
ReverseServiceI is a common interface for sandbox services
type RuntimeConfig ¶
type RuntimeConfig struct { DataDir string `json:"data-dir"` Server struct { TLSPort uint16 `json:"tls-port"` // defaults to 443. HTTPPort uint16 `json:"http-port"` // defaults to 80. NoTLS bool `json:"no-tls"` // do not start HTTPS server // TLS cert and key for the HTTPS server (if any). // Leave empty if using ManageTLSCertificates TLSCert string `json:"tls-cert"` TLSKey string `json:"tls-key"` } `json:"server"` ExternalAccess struct { Scheme string `json:"scheme"` // http or https // default to https Subdomain string `json:"subdomain"` // for users login // default to dropid Domain string `json:"domain"` Port uint16 `json:"port"` // default to 443 } `json:"external-access"` // TrustCert is used in ds2ds TrustCert string `json:"trust-cert"` LocalNetwork struct { AllowedIPs []string `json:"allowed-ips"` // Allowed IP addresses, or CIDR ranges. } `json:"local-network"` ManageTLSCertificates struct { Enable bool `json:"enable"` Email string `json:"acme-account-email"` IssuerEndpoint string `json:"issuer-endpoint"` // default use lets encrypt? RootCACertificate string `json:"root-ca-certificate"` // only needed if ds-host does TLS termination, right? Also apparently only used with issuer endpoint DisableOCSPStapling bool `json:"disable-ocsp-stapling"` // default false } `json:"manage-certificates"` Sandbox struct { SocketsDir string `json:"sockets-dir"` // do we really need this? could we not put it in DataDir/sockets? UseBubblewrap bool `json:"use-bubblewrap"` BwrapMapPaths []string `json:"bwrap-map-paths"` // for bwrap to be able to run Deno UseCGroups bool `json:"use-cgroups"` CGroupMount string `json:"cgroup-mount"` // MemoryBytesMb is the memory.high value for the cgroup that is parent of all sandboxe cgroups MemoryHighMb int `json:"memory-high-mb"` Num int `json:"num"` } `json:"sandbox"` Log string `json:"log"` Prometheus struct { Enable bool `json:"enable"` Port uint16 `json:"port"` } `json:"prometheus"` // Exec contains values determined at runtime // These are not settable via json. Exec struct { CmdVersion string PortString string UserRoutesDomain string DenoFullPath string DenoVersion string RuntimeFilesPath string SandboxCodePath string AppsPath string AppspacesPath string CertificatesPath string } }
RuntimeConfig represents the variables that can be set at runtime Or at least set via config file or cli flags that get read once upon starting ds-host. This is for server-side use only.
type SandboxI ¶
type SandboxI interface { OwnerID() UserID Operation() string AppspaceID() NullAppspaceID AppVersion() *AppVersion ExecFn(AppspaceRouteHandler) error SendMessage(int, int, []byte) (twine.SentMessageI, error) GetTransport() http.RoundTripper TiedUp() bool LastActive() time.Time NewTask() chan struct{} Status() SandboxStatus WaitFor(SandboxStatus) Start() Graceful() Kill() }
SandboxI describes the interface to a sandbox
type SandboxRun ¶
type SandboxRun struct { SandboxRunIDs SandboxRunData Start time.Time `db:"start" json:"start"` End nulltypes.NullTime `db:"end" json:"end"` }
type SandboxRunData ¶
type SandboxRunData struct { TiedUpMs int `db:"tied_up_ms" json:"tied_up_ms"` CpuUsec int `db:"cpu_usec" json:"cpu_usec"` MemoryByteSec int `db:"memory_byte_sec" json:"memory_byte_sec"` IOBytes int `db:"io_bytes" json:"io_bytes"` IOs int `db:"io_ops" json:"io_ops"` }
SandboxRunData contains the metrics of a sandbox run
type SandboxRunIDs ¶
type SandboxRunIDs struct { SandboxID int `db:"sandbox_id" json:"sandbox_id"` Instance string `db:"instance" json:"instance"` LocalID int `db:"local_id" json:"local_id"` OwnerID UserID `db:"owner_id" json:"owner_id"` AppID AppID `db:"app_id" json:"app_id"` Version Version `db:"version" json:"version"` AppspaceID NullAppspaceID `db:"appspace_id" json:"appspace_id"` Operation string `db:"operation" json:"operation"` CGroup string `db:"cgroup" json:"cgroup"` }
SandboxRunIDs contains all the identifiers relevant to a sandbox run
type SandboxStatus ¶
type SandboxStatus int
SandboxStatus represents the Status of a Sandbox
const ( // SandboxPrepared is the initial status SandboxPrepared SandboxStatus = iota + 1 // SandboxStarting sb is starting not ready yet SandboxStarting // SandboxReady means it's ready to take incoming requests SandboxReady // SandboxKilling means the system considers it is going down SandboxKilling // SandboxDead means the PID is dead SandboxDead // SandboxCleanedUp means metrics have been collected and traces of sandbox removed. SandboxCleanedUp )
type Settings ¶
type Settings struct {
RegistrationOpen bool `json:"registration_open" db:"registration_open"` //may not need json here?
}
Settings represents admin-settable parameters
type SignupViewData ¶
type SignupViewData struct { RegistrationOpen bool HasSetupKey bool FormAction string Message string Email string }
SignupViewData is used to pass messages and parameters to the login page
type TimedToken ¶
type TwineService ¶
type TwineService interface { Start(UserID, *twine.Twine) HandleMessage(twine.ReceivedMessageI) }
TwineService attach to a twine instance to handle two-way communication with a remote twine client
type TwineService2 ¶
type TwineService2 interface {
Start(UserID, *twine.Twine) TwineServiceI
}
TwineService2 returns a TwineServiceI on start
type TwineServiceI ¶
type TwineServiceI interface {
HandleMessage(twine.ReceivedMessageI)
}
TwineServiceI handles incoming messages for a twine connection
type UserInvitation ¶
type UserInvitation struct {
Email string `db:"email" json:"email"`
}
UserInvitation represents an invitation for a user to join the DropServer instance
type V0AppspaceLoginToken ¶
type V0AppspaceLoginToken struct { AppspaceID AppspaceID DropID string ProxyID ProxyID LoginToken TimedToken }
V0AppspaceLoginToken carries user auth data corresponding to a login token
type V0LoginTokenRequest ¶
V0LoginTokenRequest is sent to the host that manages the appspace
type V0LoginTokenResponse ¶
type V0LoginTokenResponse struct { Appspace string `json:"appspace"` Token string `json:"token"` Ref string `json:"ref"` }
V0PostLoginToken is the data sent from appspace host to dropid host when a user requests a token to remote log-in