doc/catalog.txt
author Edward Pilatowicz <edward.pilatowicz@oracle.com>
Mon, 16 Sep 2013 21:26:31 -0700
changeset 2945 24196b483cc6
parent 926 6ee411c9026a
permissions -rw-r--r--
17461187 packagemanager displays unexpected error message
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
     1
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
     2
pkg
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
     3
CATALOG AND INVENTORY OPERATIONS
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
     4
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
     5
[Suspended] Premise 1:  From the client's perspective, the catalog is just
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
     6
another package.  (It's only special in that its contents drive
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
     7
automatic package operations.)
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
     8
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
     9
   Because we pull catalogs from multiple repositories, managing N
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    10
   packages for N repositories seems overcomplicated.
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    11
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    12
Premise 2:  From the server perspective, the catalog is a file whose
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    13
contents are updated as a result of the set of packaging operations that
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    14
have occurred within the server's repository.  (No operation ever
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    15
affects the catalog directly.)
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    16
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    17
1.  Server catalog
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    18
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    19
The primary content of the catalog is the relationships between
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    20
packages.  We've already said that there are packages that depend on
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    21
other packages and packages that incorporate other packages.  These
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    22
latter packages, the base- and stack-style packages, are really packages
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    23
that, in addition to listing a set of packages, also freeze those
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    24
packages, such that it takes a relaxation of the base/stack package for
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    25
the client to modify the incorporated packages.
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    26
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    27
The detailed manifest for each package contains the dependencies,
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    28
contents, and actions.  But, as it seems that the set of incorporation
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    29
relationships are of particular interest for reporting and determining
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    30
package retrieval ordering, we place incorporation dependencies in the
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    31
catalog as well.
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    32
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    33
It's reasonably clear that the package repository needs to have
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    34
observations of package popularity, so that the most aged packages can
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    35
be purged, once unneeded.
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    36
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    37
2.  Client catalog and client inventory
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    38
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    39
The client catalog is a compilation of package sourcing information from
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    40
a collection of repositories, in the form of one server catalog per
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    41
repository.  Its purpose is to advertise what package versions are
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    42
"available", which means that it is the union of the repositories it
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    43
sources.
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    44
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    45
In contrast, the client inventory is the set of packages currently in an
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    46
installation state on the system, stored in some representation.  One
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    47
form of this representation will be in the form of a server catalog.
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    48
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    49
The inventory is stored under 
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    50
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    51
/var/pkg/db
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    52
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    53
If some instance of [email protected] is installed, we would have a directory
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    54
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 30
diff changeset
    55
/var/pkg/db/pkg/[publisher?]/which/2.16
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 30
diff changeset
    56
				publisher
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    57
				manifest
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    58
				state
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    59
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    60
XXX Can we have two packages with the same name, but from different
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 30
diff changeset
    61
publishers?
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    62
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    63
An open question is whether we store one or more reverse indices in the
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    64
inventory.  We could have indices into basenames, pathnames, and
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    65
contents, which would look something like:
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    66
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    67
/var/pkg/db/index/
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    68
		{basename,path}/
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    69
			[escaped basename or full path]/
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    70
				named links to content files
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    71
		
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    72
		content/
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    73
			[SHA1 hash of contents] -> package directory
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    74
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    75
Unfortunately, since FILE_MAX < PATH_MAX, the escaped representation for
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    76
full paths is insufficient, and we might need to provide a hash-based
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    77
directory name, and a metadata file with the full path.
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    78
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    79
2.1.  Multiple catalogs
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    80
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    81
If a package is available from two or more repositories, we have a
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    82
choice:  we can prefer a repository (as we would for a request for a
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    83
first installation of a package), or we can store both catalogue
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    84
entries.
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    85
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    86
In a directory-based approach, we might have
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    87
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 30
diff changeset
    88
/var/pkg/catalog/repository_publisher/category/package/versions
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    89
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    90
with example
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    91
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    92
/var/pkg/catalog/pkg.opensolaris.org/application/which/2.16
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    93
/var/pkg/catalog/blueslugs.com/application/which/2.16
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    94
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    95
In a file-based approach, we would have
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    96
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    97
/var/pkg/catalog/[escaped_catalog_URL]
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
    98
...
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
    99
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
   100
XXX Investigate efficiency of encoding versions as entries in
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
   101
a file versus encoding as separate files
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
   102
30
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
   103
XXX Are FMRI-level categories actually a help, or is a detailed,
f06ad6cb4b3f stop using flavour terminology
Stephen Hahn <sch@sun.com>
parents: 13
diff changeset
   104
hierarchical namespace going to get in the way?
13
2a4c0dd21262 add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff changeset
   105