package
2.0.0-rc2+incompatible
Repository: https://github.com/deis/workflow-manager-api.git
Documentation: pkg.go.dev

# README

API Persistent Data Architecture

The Workflow Manager Service API stores persistent data via an AWS RDS+postgres instance. We use the AWS SDK for go to connect to the RDS service.

Prerequisites

  • Environment-aware AWS configuration (e.g., runtime access to working AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables)
  • Existing RDS instance using the PostgreSQL 9.4.5 engine

Bootstrapping

The data package is designed to bootstrap from scratch a working (empty) table schema if one does not exist, or to use an existing implementation. This is currently a one-time operation that happens at application launch time.

Table Schemas

Data is organized into three tables, with fields outlined below:

  • clusters, a table that stores "Cluster" records (each cluster record maps to a unique deis cluster seen in the wild)
    • cluster_id uuid PRIMARY KEY
    • data json
  • clusters_checkins, a table that stores records of deis clusters checking in with the API
    • checkins_id bigserial PRIMARY KEY
    • cluster_id uuid
    • created_at timestamp
    • data json
  • versions, a table that stores authoritative deis component version information
    • version_id bigserial PRIMARY KEY
    • component_name varchar(32)
    • train varchar(24)
    • version varchar(32)
    • release_timestamp timestamp
    • data json
    • with a uniqueness constraint unique (component_name, train, version)

License

Copyright 2016 Engine Yard, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

# Functions

CheckInCluster creates a new record in the cluster checkins DB to indicate that the cluster has checked in right now.
FilterClustersByAge returns a slice of clusters whose various time fields match the requirements in the given filter.
GetCluster gets the cluster from the DB with the given cluster ID.
GetClusterCount returns the total number of clusters in the database.
GetLatestVersion gets the latest version from the DB for the given train & component.
GetLatestVersions fetches from the DB and returns the latest versions for each component/train pair given in ct.
GetVersion gets a single version record from a DB matching the unique property values in a ComponentVersion struct.
GetVersionsList retrieves a list of version records from the DB that match a given train & component.
NewClusterAgeFilter returns a new ClusterAgeFilter if the given times can result in a valid query that would return clusters.
NewRDSDB attempts to discover and connect to a postgres database managed by Amazon RDS.
UpsertCluster creates or updates the cluster with the given ID.
UpsertVersion adds or updates a single version record in the database.
VerifyPersistentStorage is a high level interace for verifying storage abstractions.

# Constants

StdTimestampFmt is the standard format of timestamps used to store times in the database and accept and send timestamps over the wire.

# Structs

ClusterAgeFilter is the struct used to filter on cluster ages.
ComponentAndTrain represents a component and its train.
ErrImpossibleFilter is the error returned when a caller tries to create a new ClusterAgeFilter with parameters that would create a filter that is guaranteed to produce no results.
Timestamp is a fmt.Stringer, sql.Scanner and driver.Valuer implementation which is able to encode and decode time.Time values into and out of a database.