local_db

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DB_NAME is the name of the database.
	DB_NAME = "task_scheduler_db"

	// DB_FILENAME is the name of the file in which the database is stored.
	DB_FILENAME = "task_scheduler.bdb"

	// BUCKET_TASKS is the name of the Tasks bucket. Key is Task.Id, which is set
	// to (creation time, sequence number) (see formatId for detail), value is
	// described in docs for BUCKET_TASKS_VERSION. Tasks will be updated in place.
	// All repos share the same bucket.
	BUCKET_TASKS = "tasks"
	// BUCKET_TASKS_FILL_PERCENT is the value to set for bolt.Bucket.FillPercent
	// for BUCKET_TASKS. BUCKET_TASKS will be append-mostly, so use a high fill
	// percent.
	BUCKET_TASKS_FILL_PERCENT = 0.9
	// BUCKET_TASKS_VERSION indicates the format of the value of BUCKET_TASKS
	// written by PutTasks. Retrieving Tasks from the DB must support all previous
	// versions. For all versions, the first byte is the version number.
	//   Version 1: v[0] = 1; v[1:9] is the modified time as UnixNano encoded as
	//     big endian; v[9:] is the GOB of the Task.
	BUCKET_TASKS_VERSION = 1

	// BUCKET_JOBS is the name of the Jobs bucket. Key is Job.Id, which is set to
	// (creation time, sequence number) (see formatId for detail), value is
	// described in docs for BUCKET_JOBS_VERSION. Jobs will be updated in place.
	// All repos share the same bucket.
	BUCKET_JOBS = "jobs"
	// BUCKET_JOBS_FILL_PERCENT is the value to set for bolt.Bucket.FillPercent
	// for BUCKET_JOBS. BUCKET_JOBS will be append-mostly, so use a high fill
	// percent.
	BUCKET_JOBS_FILL_PERCENT = 0.9
	// BUCKET_JOBS_VERSION indicates the format of the value of BUCKET_JOBS
	// written by PutJobs. Retrieving Jobs from the DB must support all previous
	// versions. For all versions, the first byte is the version number.
	//   Version 1: v[0] = 1; v[1:9] is the modified time as UnixNano encoded as
	//     big endian; v[9:] is the GOB of the Job.
	BUCKET_JOBS_VERSION = 1

	// BUCKET_COMMENTS is the name of the comments bucket. Key is KEY_COMMENT_MAP,
	// value is the GOB of the map provided by db.CommentBox. The comment map will
	// be updated in place. All repos share the same bucket.
	BUCKET_COMMENTS = "comments"
	KEY_COMMENT_MAP = "comment-map"

	// BUCKET_BACKUP is the name of the backup bucket. Key is
	// KEY_INCREMENTAL_BACKUP_TIME, value is time.Time.MarshalBinary. The value
	// will be updated in place.
	BUCKET_BACKUP               = "backup"
	KEY_INCREMENTAL_BACKUP_TIME = "inc-backup-ts"

	// TIMESTAMP_FORMAT is a format string passed to Time.Format and time.Parse to
	// format/parse the timestamp in the Task ID. It is similar to
	// util.RFC3339NanoZeroPad, but since Task.Id can not contain colons, we omit
	// most of the punctuation. This timestamp can only be used to format and
	// parse times in UTC.
	TIMESTAMP_FORMAT = util.SAFE_TIMESTAMP_FORMAT
	// SEQUENCE_NUMBER_FORMAT is a format string passed to fmt.Sprintf or
	// fmt.Sscanf to format/parse the sequence number in the Task ID. It is a
	// 16-digit zero-padded lowercase hexidecimal number.
	SEQUENCE_NUMBER_FORMAT = "%016x"

	// MAX_CREATED_TIME_SKEW is the maximum difference between the timestamp in a
	// Task's Id field and that Task's Created field. This allows AssignId to be
	// called before creating the Swarming task so that the Id can be included in
	// the Swarming task tags. GetTasksFromDateRange accounts for this skew when
	// retrieving tasks. This value can be increased in the future, but can never
	// be decreased.
	//
	// 6 minutes is based on httputils.DIAL_TIMEOUT + httputils.REQUEST_TIMEOUT,
	// which is assumed to be the approximate maximum duration of a successful
	// swarming.ApiClient.TriggerTask() call.
	MAX_CREATED_TIME_SKEW = 6 * time.Minute
)

Variables

This section is empty.

Functions

func NewDB

func NewDB(name, filename string, mod db.ModifiedData) (db.BackupDBCloser, error)

NewDB returns a local DB instance.

func ParseId

func ParseId(id string) (time.Time, uint64, error)

ParseId returns the timestamp and sequence number stored in a Task or Job ID.

Types

This section is empty.

Directories

Path Synopsis
busywork is an end-to-end test for local_db.
busywork is an end-to-end test for local_db.
Read data from a local task scheduler DB file and output as JSON.
Read data from a local task scheduler DB file and output as JSON.

Jump to

Keyboard shortcuts

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