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-- |
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 | 3 |
CATALOG AND INVENTORY OPERATIONS |
13
2a4c0dd21262
add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff
changeset
|
4 |
|
30 | 5 |
[Suspended] Premise 1: From the client's perspective, the catalog is just |
6 |
another package. (It's only special in that its contents drive |
|
7 |
automatic package operations.) |
|
13
2a4c0dd21262
add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff
changeset
|
8 |
|
30 | 9 |
Because we pull catalogs from multiple repositories, managing N |
10 |
packages for N repositories seems overcomplicated. |
|
11 |
||
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 | 14 |
have occurred within the server's repository. (No operation ever |
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 | 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 | 21 |
other packages and packages that incorporate other packages. These |
22 |
latter packages, the base- and stack-style packages, are really packages |
|
23 |
that, in addition to listing a set of packages, also freeze those |
|
24 |
packages, such that it takes a relaxation of the base/stack package for |
|
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 | 28 |
contents, and actions. But, as it seems that the set of incorporation |
29 |
relationships are of particular interest for reporting and determining |
|
30 |
package retrieval ordering, we place incorporation dependencies in the |
|
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 | 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 | 40 |
a collection of repositories, in the form of one server catalog per |
41 |
repository. Its purpose is to advertise what package versions are |
|
42 |
"available", which means that it is the union of the repositories it |
|
43 |
sources. |
|
44 |
||
45 |
In contrast, the client inventory is the set of packages currently in an |
|
46 |
installation state on the system, stored in some representation. One |
|
47 |
form of this representation will be in the form of a server catalog. |
|
48 |
||
49 |
The inventory is stored under |
|
50 |
||
51 |
/var/pkg/db |
|
52 |
||
53 |
If some instance of [email protected] is installed, we would have a directory |
|
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 | 57 |
manifest |
58 |
state |
|
13
2a4c0dd21262
add initial catalog description, state machines
"Stephen Hahn <sch@sun.com>"
parents:
diff
changeset
|
59 |
|
30 | 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 | 62 |
|
63 |
An open question is whether we store one or more reverse indices in the |
|
64 |
inventory. We could have indices into basenames, pathnames, and |
|
65 |
contents, which would look something like: |
|
66 |
||
67 |
/var/pkg/db/index/ |
|
68 |
{basename,path}/ |
|
69 |
[escaped basename or full path]/ |
|
70 |
named links to content files |
|
71 |
||
72 |
content/ |
|
73 |
[SHA1 hash of contents] -> package directory |
|
74 |
||
75 |
Unfortunately, since FILE_MAX < PATH_MAX, the escaped representation for |
|
76 |
full paths is insufficient, and we might need to provide a hash-based |
|
77 |
directory name, and a metadata file with the full path. |
|
78 |
||
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 | 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 | 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 | 97 |
/var/pkg/catalog/[escaped_catalog_URL] |
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 | 103 |
XXX Are FMRI-level categories actually a help, or is a detailed, |
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 |