model

package
v0.0.0-...-a420e69 Latest Latest
Warning

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

Go to latest
Published: May 24, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	BucketId    string    `json:"bucketId"`
	DateCreated time.Time `json:"dateCreated"`
	// Auto-generated globally unique id.
	Id int64 `json:"id"`
	// id that must be unique within a bucket (but not necessairly globally).
	// For streamed artifacts this is often the file name.
	Name string `json:"name"`
	// This is deterministically generated as /<BucketId>/<Name> but in case we wish to
	// switch conventions later we store it.
	S3URL        string        `json:"s3URL"`
	Size         int64         `json:"size"`
	State        ArtifactState `json:"state"`
	DeadlineMins uint          `json:"deadlineMins"`
	RelativePath string        `json:"relativePath"`
}

func (*Artifact) DefaultS3URL

func (a *Artifact) DefaultS3URL() string

type ArtifactState

type ArtifactState uint
const (
	UNKNOWN_ARTIFACT_STATE ArtifactState = 0

	// Error during streamed upload.
	ERROR ArtifactState = 1

	// Log file being streamed in chunks. We currently store them as LogChunks.
	APPENDING ArtifactState = 2

	// Once the artifact has been finalized (or the bucket closed), the artifact which was being
	// appended will be marked for compaction and upload to S3.
	APPEND_COMPLETE ArtifactState = 3

	// The artifact is waiting for a file upload request to stream through to S3.
	WAITING_FOR_UPLOAD ArtifactState = 4

	// If the artifact is in LogChunks, it is now being merged and uploaded to S3.
	// Else, the file is being passed through to S3 directly from the client.
	UPLOADING ArtifactState = 5

	// Terminal state: the artifact is in S3 in its entirety.
	UPLOADED ArtifactState = 6

	// Deadline exceeded before APPEND_COMPLETE OR UPLOADED
	DEADLINE_EXCEEDED ArtifactState = 7

	// Artifact was closed without any appends or upload operation.
	CLOSED_WITHOUT_DATA ArtifactState = 8
)

NOTE: Do not reorder. Always append new entries to the bottom. Any existing entries which are deprecated should be renamed from FOO to DEPRECATED_FOO and left in the same position.

Please remember to update StateString

func (ArtifactState) String

func (i ArtifactState) String() string

type Bucket

type Bucket struct {
	DateClosed  time.Time `json:"dateClosed"`
	DateCreated time.Time `json:"dateCreated"`
	// Must be globally unique even between different owners. Other than that, it can
	// be arbitrary.
	Id string `json:"id"`
	// A characteristic string signifying what service owns the bucket.
	Owner string      `json:"owner"`
	State BucketState `json:"state"`
}

type BucketState

type BucketState uint
const (
	// A Bucket should never be in this state.
	UNKNOWN BucketState = iota

	// Accepting new artifacts and appends to existing artifacts
	OPEN

	// No further changes to this bucket. No new artifacts or appends to existing ones.
	CLOSED

	// Similar to `CLOSED`. Was forcibly closed because it was not explicitly closed before deadline.
	// TODO This isn't implemented yet. Implement it.
	TIMEDOUT
)

Please remember to update the mapping to strings.

func (BucketState) String

func (i BucketState) String() string

type LogChunk

type LogChunk struct {
	// Automatically-generated unique id.
	Id           int64
	ArtifactId   int64
	ByteOffset   int64
	Size         int64
	ContentBytes []byte `db:"content_bytes"`
}

Jump to

Keyboard shortcuts

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