Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ACL ¶
type ACL struct {
// Read holds users and groups that are allowed to read the charm
// or bundle.
Read []string
// Write holds users and groups that are allowed to upload/modify the charm
// or bundle.
Write []string
}
ACL holds lists of users and groups that are allowed to perform specific actions.
type BaseEntity ¶
type BaseEntity struct {
// URL holds the reference URL of of charm on bundle
// regardless of its revision, series or promulgation status
// (this omits the revision and series from URL).
// e.g., cs:~user/collection/foo
URL *charm.URL `bson:"_id"`
// User holds the user part of the entity URL (for instance, "joe").
User string
// Name holds the name of the entity (for instance "wordpress").
Name string
// Public specifies whether the charm or bundle
// is available to all users. If this is true, the ACLs will
// be ignored when reading a charm.
Public bool
// ACLs holds permission information relevant to the base entity.
// The permissions apply to all revisions.
ACLs ACL
// DevelopmentACLs is similar to ACLs but applies to all development
// revisions.
DevelopmentACLs ACL
// Promulgated specifies whether the charm or bundle should be
// promulgated.
Promulgated IntBool
// CommonInfo holds arbitrary common extra metadata associated with
// the base entity. Thhose data apply to all revisions.
// The byte slices hold JSON-encoded data.
CommonInfo map[string][]byte `bson:",omitempty" json:",omitempty"`
}
BaseEntity holds metadata for a charm or bundle independent of any specific uploaded revision or series.
type Entity ¶
type Entity struct {
// URL holds the fully specified URL of the charm or bundle.
// e.g. cs:precise/wordpress-34, cs:~user/trusty/foo-2
URL *charm.URL `bson:"_id"`
// BaseURL holds the reference URL of the charm or bundle
// (this omits the series and revision from URL)
// e.g. cs:wordpress, cs:~user/foo
BaseURL *charm.URL
// User holds the user part of the entity URL (for instance, "joe").
User string
// Name holds the name of the entity (for instance "wordpress").
Name string
// Revision holds the entity revision (it cannot be -1/unset).
Revision int
// Series holds the entity series (for instance "trusty" or "bundle").
// For multi-series charms, this will be empty.
Series string
// SupportedSeries holds the series supported by a charm.
// For non-multi-series charms, this is a single element slice
// containing the value in Series.
SupportedSeries []string
// PreV5BlobHash holds the hash checksum of the
// blob that will be served from the v4 and legacy
// APIs. This will be the same as BlobHash for single-series charms.
PreV5BlobHash string
// PreV5BlobSize holds the size of the
// blob that will be served from the v4 and legacy
// APIs. This will be the same as Size for single-series charms.
PreV5BlobSize int64
// PreV5BlobHash256 holds the SHA256 hash checksum
// of the blob that will be served from the v4 and legacy
// APIs. This will be the same as Hash256 for single-series charms.
PreV5BlobHash256 string
// BlobHash holds the hash checksum of the blob, in hexadecimal format,
// as created by blobstore.NewHash.
BlobHash string
// BlobHash256 holds the SHA256 hash checksum of the blob,
// in hexadecimal format. This is only used by the legacy
// API, and is calculated lazily the first time it is required.
// Note that this is calculated from the pre-V5 blob.
BlobHash256 string
// Size holds the size of the archive blob.
// TODO(rog) rename this to BlobSize.
Size int64
// BlobName holds the name that the archive blob is given in the blob store.
// For multi-series charms, there is also a second blob which
// stores a "zip-suffix" that overrides metadata.yaml.
// This is named BlobName + ".pre-v5-suffix".
BlobName string
UploadTime time.Time
// ExtraInfo holds arbitrary extra metadata associated with
// the entity. The byte slices hold JSON-encoded data.
ExtraInfo map[string][]byte `bson:",omitempty" json:",omitempty"`
// TODO(rog) verify that all these types marshal to the expected
// JSON form.
CharmMeta *charm.Meta
CharmConfig *charm.Config
CharmActions *charm.Actions
// CharmProvidedInterfaces holds all the relation
// interfaces provided by the charm
CharmProvidedInterfaces []string
// CharmRequiredInterfaces is similar to CharmProvidedInterfaces
// for required interfaces.
CharmRequiredInterfaces []string
BundleData *charm.BundleData
BundleReadMe string
// BundleCharms includes all the charm URLs referenced
// by the bundle, including base URLs where they are
// not already included.
BundleCharms []*charm.URL
// BundleMachineCount counts the machines used or created
// by the bundle. It is nil for charms.
BundleMachineCount *int
// BundleUnitCount counts the units created by the bundle.
// It is nil for charms.
BundleUnitCount *int
// Contents holds entries for frequently accessed
// entries in the file's blob. Storing this avoids
// the need to linearly read the zip file's manifest
// every time we access one of these files.
Contents map[FileId]ZipFile `json:",omitempty" bson:",omitempty"`
// PromulgatedURL holds the promulgated URL of the entity. If the entity
// is not promulgated this should be set to nil.
PromulgatedURL *charm.URL `json:",omitempty" bson:"promulgated-url,omitempty"`
// PromulgatedRevision holds the revision number from the promulgated URL.
// If the entity is not promulgated this should be set to -1.
PromulgatedRevision int `bson:"promulgated-revision"`
// Development holds whether the entity is in development or published.
// A development entity can only be referred to using URLs including the
// "development" channel.
Development bool
}
Entity holds the in-database representation of charm or bundle's document in the charms collection. It holds information on one specific revision and series of the charm or bundle - see also BaseEntity.
We ensure that there is always a single BaseEntity for any set of entities which share the same base URL.
func (*Entity) PreferredURL ¶
PreferredURL returns the preferred way to refer to this entity. If the entity has a promulgated URL and usePromulgated is true then the promulgated URL will be used, otherwise the standard URL is used.
The returned URL may be modified freely.
type IntBool ¶
type IntBool bool
IntBool is a bool that will be represented internally in the database as 1 for true and -1 for false.
type Log ¶
type Log struct {
// Data holds the JSON-encoded log message.
Data []byte
// Level holds the log level: whether the log is a warning, an error, etc.
Level LogLevel
// Type holds the log type.
Type LogType
// URLs holds a slice of entity URLs associated with the log message.
URLs []*charm.URL
// Time holds the time of the log.
Time time.Time
}
Log holds the in-database representation of a log message sent to the charm store.
type LogLevel ¶
type LogLevel int
LogLevel holds the level associated with a log.
const ( InfoLevel LogLevel WarningLevel ErrorLevel )
When introducing a new log level, do the following:
- add the new level as a constant below;
- add the new level in params as a string for HTTP requests/responses;
- include the new level in the mongodocLogLevels and paramsLogLevels maps in internal/v4.
type LogType ¶
type LogType int
LogType holds the type of the log.
const ( IngestionType LogType LegacyStatisticsType )
When introducing a new log type, do the following:
- add the new type as a constant below;
- add the new type in params as a string for HTTP requests/responses;
- include the new type in the mongodocLogTypes and paramsLogTypes maps in internal/v4.
type Migration ¶
type Migration struct {
// Executed holds the migration names for migrations already executed.
Executed []MigrationName
}
Migration holds information about the database migration.
type MigrationName ¶
type MigrationName string
type ZipFile ¶
type ZipFile struct {
// Compressed specifies whether the file is compressed or not.
Compressed bool
// Offset holds the offset into the zip archive of the start of
// the file's data.
Offset int64
// Size holds the size of the file before decompression.
Size int64
}
ZipFile refers to a specific file in the uploaded archive blob.