swarmops info#
Describe the store.
- Group
store- Since
0.1.0- Mutates
- no
- Identity required
- no
- MCP tool
repo_info- Envelope op
repo_info- Exit codes
- 0126
Syntax#
swarmops info [OPTIONS]Required arguments#
None.
Optional arguments#
The command also takes the global options.
Examples#
swarmops --repo [tmp]/store info{
"ok": true,
"op": "repo_info",
"api": 1,
"result": {
"repo_id": "[repo_id]",
"name": "store",
"store_version": 1,
"changesets": 0,
"refs": 0
},
"meta": {
"repo": "[tmp]/store",
"elapsed_ms": "[elapsed_ms]",
"resolved": {},
"auth": "trust"
}
}Exit code 0. Recorded by the CLI tests. A name in square brackets, such as [tmp] or [c1], stands for what differs from run to run: the test's temporary directory, an id, a time.
No recorded example yet.
Details#
info opens the store, reads its metadata in one snapshot and prints what the store is and
holds. It reads only: it needs no identity, takes no lock and writes nothing. Its MCP tool is
repo_info, which takes no arguments.
What it reports#
repo_idandnamecome from the store'sREPOfile, fixed atinit.store_versionis the layout version the store'sFORMATfile names, 1 for every store this release makes.changesetscounts every changeset the store holds, those no ref reaches included: a commit that was never landed counts.refscounts the refs,mainand everyrelease/<name>.mainis the full id of the changesetmainnames. The field is left out untilmainexists, so a script tells an empty store by its absence.
All five come from the same snapshot, so they agree with each other at one moment. Another
writer may move main right after: to build on main, read it once and pass that id as
commit --parent, as Publish a change
does with resolve main.
Patterns#
- A health check:
infoexits 0 exactly when the store opens and its metadata reads. Run it before handing a store to agents, or from a monitoring job. - Find the store a script will use:
meta.reposays which store the command opened, as you named it in--repoorSWARMOPS_REPO. - Count growth:
changesetsrises with every commit and every land, and never falls, since the store removes nothing yet (Monitoring lists what else to watch).
Failures#
- No store named, neither
--reponorSWARMOPS_REPO, or an empty--repo, isE_NOT_A_REPO(exit 6). An empty--repodoes not fall back toSWARMOPS_REPO. - A directory without a
FORMATfile isE_NOT_A_REPO, with the hintswarmops init <dir>; aFORMATthat names another layout version isE_NOT_A_REPOtoo, the store being of a layout this build does not read (Upgrade). - A
SWARMOPS_REPOthat is not UTF-8 isE_INVALID_ARG(exit 2), withdetails.sourcenaming the variable. - A damaged metadata file is
E_STORE_CORRUPT, with the hintswarmops verify; a store under/mnt/isE_UNSUPPORTED_FS.
Return information#
result is a RepoInfo (swarmops schema RepoInfo prints its JSON Schema).
| Field | Type | Required | Description |
|---|---|---|---|
changesets | integer | yes | How many changesets the store holds. |
main | string or null | no | The changeset main points at; omitted until main exists. |
name | string | yes | The name given at init. |
refs | integer | yes | How many refs the store holds. |
repo_id | string | yes | The store's id, fixed at init. |
store_version | integer | yes | The store format version. |
Envelope op: repo_info.
Exit codes:
0: Success.1: The operation failed.2: The request or the command line is malformed.6: Something the request names does not exist.
Errors#
- E_NOT_A_REPO (exit 6): No store at the given path, or no store was named.
- E_STORE_CORRUPT (exit 1): Stored data failed verification.
- E_INVALID_ARG (exit 2): A malformed argument or request, including a command-line usage error.
- E_IO (exit 1): The filesystem refused an operation:
details.fs_opnames it, anddetails.store_filethe file of the store it was on, relative to the store's root.
Any command that opens a store may also fail with a store error, such as E_NOT_A_REPO, E_IO or E_STORE_CORRUPT; a command line the grammar refuses is E_INVALID_ARG (exit 2).