types

package
v0.0.0-...-1d800d4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoCheck       = CheckMode("")
	SilentCheck   = CheckMode("silent")
	ErrorCheck    = CheckMode("error")
	ValidateCheck = CheckMode("validate")
)
View Source
const (
	SyncTypeFullIncremental = SyncType("full")
	SyncTypeIncremental     = SyncType("incremental")
)
View Source
const SyncStateCleared = SyncState("")

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildId

type BuildId string

func GenerateBuildId

func GenerateBuildId() (BuildId, error)

GenerateBuildId yields a secure unique id It contains a 16 hex char long timestamp in ns precision, a hyphen and another 16 hex char long random string.

func (BuildId) Age

func (i BuildId) Age() (time.Duration, error)

func (BuildId) Validate

func (i BuildId) Validate() error

type CacheBaseDir

type CacheBaseDir string

func (CacheBaseDir) ProjectCacheDir

func (d CacheBaseDir) ProjectCacheDir(namespace Namespace) ProjectCacheDir

func (CacheBaseDir) StateFile

func (d CacheBaseDir) StateFile(namespace Namespace) string

type CheckMode

type CheckMode string

func (CheckMode) Validate

func (c CheckMode) Validate() error

type CodePosition

type CodePosition struct {
	FileName sharedTypes.PathName `json:"file"`
	Row      int64                `json:"line"`
	Column   int64                `json:"column"`
}

type CodePositions

type CodePositions []CodePosition

type CommandLine

type CommandLine []string

type CommandOutputFiles

type CommandOutputFiles struct {
	StdErr sharedTypes.PathName `json:"stdErr"`
	StdOut sharedTypes.PathName `json:"stdOut"`
}

func (*CommandOutputFiles) Cleanup

func (f *CommandOutputFiles) Cleanup(dir CompileDir)

type CommonRequestOptions

type CommonRequestOptions struct {
	CompileGroup sharedTypes.CompileGroup `json:"compileGroup"`
	ImageName    sharedTypes.ImageName    `json:"imageName"`
}

func (*CommonRequestOptions) GetImageName

func (o *CommonRequestOptions) GetImageName() sharedTypes.ImageName

func (*CommonRequestOptions) SetCompileGroup

func (o *CommonRequestOptions) SetCompileGroup(cg sharedTypes.CompileGroup)

func (*CommonRequestOptions) SetImageName

func (o *CommonRequestOptions) SetImageName(i sharedTypes.ImageName)

func (*CommonRequestOptions) Validate

func (o *CommonRequestOptions) Validate() error

type CompileBaseDir

type CompileBaseDir string

func (CompileBaseDir) CompileDir

func (d CompileBaseDir) CompileDir(namespace Namespace) CompileDir

type CompileDir

type CompileDir string

func (CompileDir) Join

func (d CompileDir) Join(name sharedTypes.DirEntry) string

type CompileError

type CompileError string

type CompileOptions

type CompileOptions struct {
	Check            CheckMode                  `json:"check"`
	Compiler         sharedTypes.Compiler       `json:"compiler"`
	CompileGroup     sharedTypes.CompileGroup   `json:"compileGroup"`
	Draft            DraftModeFlag              `json:"draft"`
	ImageName        sharedTypes.ImageName      `json:"imageName"`
	RootResourcePath sharedTypes.PathName       `json:"rootResourcePath"`
	SyncState        SyncState                  `json:"syncState"`
	SyncType         SyncType                   `json:"syncType"`
	Timeout          sharedTypes.ComputeTimeout `json:"timeout"`
}

func (CompileOptions) Hash

func (CompileOptions) Validate

func (c CompileOptions) Validate() error

type CompileOptionsHash

type CompileOptionsHash string

type CompileOutputDir

type CompileOutputDir string

func (CompileOutputDir) Join

func (CompileOutputDir) JoinDir

func (d CompileOutputDir) JoinDir(name sharedTypes.DirName) string

type CompileRequest

type CompileRequest struct {
	Options   CompileOptions `json:"options"`
	Resources Resources      `json:"resources"`

	// Internal fields.
	RootDoc              *Resource `json:"-"`
	RootDocAliasResource *Resource `json:"-"`
}

func (*CompileRequest) Preprocess

func (c *CompileRequest) Preprocess() error

func (*CompileRequest) Validate

func (c *CompileRequest) Validate() error

type CompileResponse

type CompileResponse struct {
	Status      CompileStatus `json:"status,omitempty"`
	Error       CompileError  `json:"error,omitempty"`
	OutputFiles OutputFiles   `json:"outputFiles"`
	Timings     Timings       `json:"timings"`
}

type CompileStatus

type CompileStatus string

type ContentDir

type ContentDir string

func (ContentDir) Join

func (d ContentDir) Join(hash sharedTypes.Hash) string

type DockerContainerOptions

type DockerContainerOptions struct {
	User                   string        `json:"user"`
	Env                    Environment   `json:"env"`
	AgentPathContainer     string        `json:"agent_path_container"`
	AgentPathHost          string        `json:"agent_path_host"`
	AgentContainerLifeSpan time.Duration `json:"agent_container_life_span_ns"`
	AgentRestartAttempts   int64         `json:"agent_restart_attempts"`

	Runtime           string `json:"runtime"`
	SeccompPolicyPath string `json:"seccomp_policy_path"`

	CompileBaseDir CompileBaseDir `json:"compile_base_dir"`
	OutputBaseDir  OutputBaseDir  `json:"output_base_dir"`
}

type DownloadPath

type DownloadPath string

func BuildDownloadPath

func BuildDownloadPath(projectId, userId sharedTypes.UUID, buildId BuildId, name sharedTypes.PathName) DownloadPath

func BuildDownloadPathFromNamespace

func BuildDownloadPathFromNamespace(namespace Namespace, buildId BuildId, name sharedTypes.PathName) DownloadPath

type DraftModeFlag

type DraftModeFlag bool

func (DraftModeFlag) Validate

func (d DraftModeFlag) Validate() error

type Environment

type Environment []string

type ExecAgentRequestOptions

type ExecAgentRequestOptions struct {
	CommandLine                `json:"command_line"`
	Environment                `json:"environment,omitempty"`
	sharedTypes.ImageName      `json:"imageName"`
	sharedTypes.ComputeTimeout `json:"timeout"`
	CommandOutputFiles         `json:"command_output_files"`
}

type ExecAgentResponseBody

type ExecAgentResponseBody struct {
	ExitCode     ExitCode          `json:"exitCode,omitempty"`
	ErrorMessage string            `json:"error_message,omitempty"`
	Timed        sharedTypes.Timed `json:"timed"`
}

type ExitCode

type ExitCode int64

type Namespace

type Namespace string

func (Namespace) IsAnonymous

func (n Namespace) IsAnonymous() bool

type Options

type Options struct {
	AllowedImages []sharedTypes.ImageName `json:"allowed_images"`

	CopyExecAgentSrc string `json:"copy_exec_agent_src"`
	CopyExecAgentDst string `json:"copy_exec_agent_dst"`

	ProjectCacheDuration    time.Duration `json:"project_cache_duration_ns"`
	RefreshHealthCheckEvery time.Duration `json:"health_check_refresh_every_ns"`

	ParallelOutputWrite       int64 `json:"parallel_output_write"`
	ParallelResourceWrite     int64 `json:"parallel_resource_write"`
	MaxFilesAndDirsPerProject int64 `json:"max_files_and_dirs_per_project"`

	URLDownloadRetries int64         `json:"url_download_retries"`
	URLDownloadTimeout time.Duration `json:"url_download_timeout_ns"`

	Paths

	LatexBaseEnv Environment `json:"latex_base_env"`

	Runner                 string                 `json:"runner"`
	DockerContainerOptions DockerContainerOptions `json:"docker_container_options"`
}

func (*Options) FillFromEnv

func (o *Options) FillFromEnv()

func (*Options) Validate

func (o *Options) Validate() error

type OutputBaseDir

type OutputBaseDir string

func (OutputBaseDir) OutputDir

func (d OutputBaseDir) OutputDir(namespace Namespace) OutputDir

type OutputDir

type OutputDir string

func (OutputDir) CompileOutput

func (d OutputDir) CompileOutput() string

func (OutputDir) CompileOutputDir

func (d OutputDir) CompileOutputDir(id BuildId) CompileOutputDir

func (OutputDir) ContentDir

func (d OutputDir) ContentDir(id BuildId) ContentDir

func (OutputDir) ContentDirBase

func (d OutputDir) ContentDirBase() string

func (OutputDir) Tracker

func (d OutputDir) Tracker() string

type OutputFile

type OutputFile struct {
	Build        BuildId              `json:"build"`
	DownloadPath DownloadPath         `json:"url"`
	Path         sharedTypes.PathName `json:"path"`
	Size         int64                `json:"size,omitempty"`
	Type         sharedTypes.FileType `json:"type"`
	Ranges       []PDFCachingRange    `json:"ranges,omitempty"`
	ContentId    BuildId              `json:"contentId,omitempty"`
}

type OutputFiles

type OutputFiles []OutputFile

func (OutputFiles) AddRanges

func (o OutputFiles) AddRanges(ranges []PDFCachingRange, contentId BuildId)

type PDFCachingRange

type PDFCachingRange struct {
	ObjectId string           `json:"objectId"`
	Start    uint64           `json:"start"`
	End      uint64           `json:"end"`
	Hash     sharedTypes.Hash `json:"hash"`
}

type PDFPosition

type PDFPosition struct {
	Page       int64   `json:"page"`
	Horizontal float64 `json:"h"`
	Vertical   float64 `json:"v"`
	Height     float64 `json:"height"`
	Width      float64 `json:"width"`
}

type PDFPositions

type PDFPositions []PDFPosition

type Paths

type Paths struct {
	CacheBaseDir   CacheBaseDir   `json:"cache_base_dir"`
	CompileBaseDir CompileBaseDir `json:"compile_base_dir"`
	OutputBaseDir  OutputBaseDir  `json:"output_base_dir"`
}

type ProjectCacheDir

type ProjectCacheDir string

func (ProjectCacheDir) Join

type Resource

type Resource struct {
	Path    sharedTypes.PathName `json:"path"`
	Content string               `json:"content,omitempty"`
	URL     *sharedTypes.URL     `json:"url,omitempty"`
	Version sharedTypes.Version  `json:"v"`
}

The Resource is either the inline doc Content, or a file with download URL.

func (*Resource) IsDoc

func (r *Resource) IsDoc() bool

func (*Resource) Validate

func (r *Resource) Validate() error

type Resources

type Resources []*Resource

func (Resources) Validate

func (r Resources) Validate() error

type StartInBackgroundRequest

type StartInBackgroundRequest struct {
	ImageName sharedTypes.ImageName `json:"imageName"`
}

func (*StartInBackgroundRequest) Validate

func (r *StartInBackgroundRequest) Validate() error

type SyncFromCodeRequest

type SyncFromCodeRequest struct {
	SyncTexOptions
	FileName sharedTypes.PathName `json:"fileName"`
	Row      int64                `json:"line"`
	Column   int64                `json:"column"`
}

func (*SyncFromCodeRequest) CommandLine

func (r *SyncFromCodeRequest) CommandLine() CommandLine

func (*SyncFromCodeRequest) Options

func (r *SyncFromCodeRequest) Options() *SyncTexOptions

func (*SyncFromCodeRequest) Validate

func (r *SyncFromCodeRequest) Validate() error

type SyncFromCodeResponse

type SyncFromCodeResponse struct {
	PDF PDFPositions `json:"pdf"`
}

type SyncFromPDFRequest

type SyncFromPDFRequest struct {
	SyncTexOptions
	Page       int64   `json:"page"`
	Horizontal float64 `json:"horizontal"`
	Vertical   float64 `json:"vertical"`
}

func (*SyncFromPDFRequest) CommandLine

func (r *SyncFromPDFRequest) CommandLine() CommandLine

func (*SyncFromPDFRequest) Options

func (r *SyncFromPDFRequest) Options() *SyncTexOptions

func (*SyncFromPDFRequest) Validate

func (r *SyncFromPDFRequest) Validate() error

type SyncFromPDFResponse

type SyncFromPDFResponse struct {
	Code CodePositions `json:"code"`
}

type SyncState

type SyncState string

func (SyncState) Validate

func (s SyncState) Validate() error

type SyncTexOptions

type SyncTexOptions struct {
	CommonRequestOptions
	BuildId BuildId `json:"buildId"`
}

func (SyncTexOptions) OutputPDFPath

func (o SyncTexOptions) OutputPDFPath() string

func (SyncTexOptions) OutputSyncTexGzPath

func (o SyncTexOptions) OutputSyncTexGzPath() string

func (*SyncTexOptions) Validate

func (o *SyncTexOptions) Validate() error

type SyncTexRequestCommon

type SyncTexRequestCommon interface {
	Options() *SyncTexOptions
	CommandLine() CommandLine
}

type SyncType

type SyncType string

func (SyncType) IsFull

func (s SyncType) IsFull() bool

func (SyncType) Validate

func (s SyncType) Validate() error

type Timings

type Timings struct {
	FetchContent sharedTypes.Timed `json:"fetchContent"`
	Compile      sharedTypes.Timed `json:"compile"`
	CompileE2E   sharedTypes.Timed `json:"compileE2E"`
	Output       sharedTypes.Timed `json:"output"`
	Sync         sharedTypes.Timed `json:"sync"`
}

type WordCountRequest

type WordCountRequest struct {
	CommonRequestOptions
	FileName sharedTypes.PathName `json:"fileName"`
}

func (*WordCountRequest) Preprocess

func (r *WordCountRequest) Preprocess() error

func (*WordCountRequest) Validate

func (r *WordCountRequest) Validate() error

type WordCountResponse

type WordCountResponse struct {
	TexCount Words `json:"texcount"`
}

type Words

type Words struct {
	Encode      string `json:"encode"`
	TextWords   int64  `json:"textWords"`
	HeadWords   int64  `json:"headWords"`
	Outside     int64  `json:"outside"`
	Headers     int64  `json:"headers"`
	Elements    int64  `json:"elements"`
	MathInline  int64  `json:"mathInline"`
	MathDisplay int64  `json:"mathDisplay"`
	Errors      int64  `json:"errors"`
	Messages    string `json:"messages"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL