Application API/Operations

From wiki.zmanda.com
Revision as of 20:02, 12 December 2008 by Dustin (talk | contribs) (merge in calling conventions)
Jump to navigation Jump to search

The Application API changes the backup server interface, but most of the code that constitutes the API itself resides on the client. The operations listed below are from the perspective of backup clients.

conventions

Commands are invoked with a single argument, the subcommand, and a number of additional options. So, for example, a simple support invocation might look like

/path/to/my/app support --config DailySet1

Properties that are specified in the Amanda configuration are provided to the application as additional command-line options, e.g.,

/path/to/my/app backup .... --FROBNICATION-ENGINE ON

If a property has several values, it will appear repeatedly on the command line:

/path/to/my/app index .... --SEARCH-PATH /foo --SEARCH-PATH /bar
XXX User:Martineau: Case sensitivity? Dashes vs. underscores?

Other languages: [[::Application API/Operations|English]] {{#ifexist: {{#if: | | {{#if: | :}}Application API/Operations}}/Fr |  • {{#if: |français| [[::Application API/Operations/Fr|français]]}}|}}

{{#ifexist: {{#if: | | {{#if: | :}}Application API/Operations}}/Zh-cn |  • {{#if: |中文(中国大陆)| [[::Application API/Operations/Zh-cn|中文(中国大陆)]]}}|}}


subcommands

support command

support [--config config] [--host host] [--disk disk] [--device device] [--PROPERTY_NAME PROPERTY_VALUE]*

0utput on fd1
   CONFIG YES|NO
   HOST YES|NO
   DISK YES|NO
   MAX-LEVEL level
   INDEX-LINE YES|NO
   INDEX-XML YES|NO
   MESSAGE-LINE YES|NO
   MESSAGE-XML YES|NO
   RECORD YES|NO
   INCLUDE YES|NO
   INCLUDE-LIST YES|NO
   INCLUDE-OPTIONAL YES|NO
   EXCLUDE YES|NO
   EXCLUDE-LIST YES|NO
   EXCLUDE-OPTIONAL YES|NO
   COLLECTION YES|NO
   CALCSIZE YES|NO
   MULTI-ESTIMATE YES|NO
   RECOVER-MODE SMB
XXX User:Martineau: What purpose does this command serve? Are all of the options required?

Other languages: [[::Application API/Operations|English]] {{#ifexist: {{#if: | | {{#if: | :}}Application API/Operations}}/Fr |  • {{#if: |français| [[::Application API/Operations/Fr|français]]}}|}}

{{#ifexist: {{#if: | | {{#if: | :}}Application API/Operations}}/Zh-cn |  • {{#if: |中文(中国大陆)| [[::Application API/Operations/Zh-cn|中文(中国大陆)]]}}|}}


backup command

backup [--message (line|xml)] [--index (line|xml)] [--config config] [--host host] [--disk disk] --device amdevice --level level [--record] [--PROPERTY_NAME PROPERTY_VALUE]*

output on fd1
   data stream
output on fd3
(if no --message or --message line)
   error message
   HEADER variable=value, information that should go in the amanda header.
   SIZE value suffix where suffix could be K, (kilobytes) M, (megabytes) or G (gigabytes)
output on fd3
(if --message xml)
   format not yet defined
output on fd4
(if --index line)
   index stream (One filename by line)
output on fd4
(if --index xml)
   xml index stream (format not yet defined)

Error messages are line-based and should begin with a | for normal ouput, ? for strange or error output, and & for unknown output

Input: Specifies what is to be backed up: A filesystem, device, particular set of files, database table, etc.

Action: Reads the specified object.

Output: A set of collections (containing the backup data), and information on a set of user objects (identifier, attributes, associated collections)

restore command

restore [--message (line|xml)] [--index (line|xml)] [--config config] [--host host] [--disk disk] --device amdevice --level level [--PROPERTY_NAME PROPERTY_VALUE]* [./file-to-restore]+

Input on fd0
   data stream
Output on fd1
(if no --message or --message line)
   error message
0utput on fd1
(if --message xml)
   format not yet defined

Input: List of user objects to be restored, relevant collections, and target locations for the restore.

Action: Reads the collections and writes the relevant user objects in their original form to the specified location.

Output: None (other than administrative messages)

index command

index [--message (line|xml)] [--index (line|xml)] [--config config] [--host host] [--disk disk] --device amdevice --level level [--PROPERTY_NAME PROPERTY_VALUE]*

 input fd1:
   data stream
 output on fd3: (if no --message or --message line)
   error message
 output on fd3: (if --message xml)
   format not yet defined
 output on fd4: (if --index line)
   index stream (One filename by line)
 output on fd4: (if --index xml)
   xml index stream

Input: Octet stream of all the collections from a single job.

Action: regenerate index data from the datastream

Output: Byte offsets for each collection in the stream, and information on the set of user objects in the stream.

estimate command

estimate [--message [line|xml]] [--config config] [--host host] [--disk disk] --device amdevice --level level [--PROPERTY_NAME PROPERTY_VALUE]*

 output on fd1: (if no --message or --message line)
   error message that should be logged.
   SIZE value'suffix where suffix could be K, M, G
 output on fd1: (if --message xml)
   format not yet defined

Input: Information on what is to be backed up: A filesystem, device, particular set of files, database table, etc.

Output: An estimate of how much space this data set will consume.

selfcheck command

selfcheck [--message (line|xml)] [--config config] [--host host] [--disk disk] --device device --level level [--record] [--PROPERTY_NAME PROPERTY_VALUE]*

Output on fd1
(if no --message or --message line) (Could be many lines)
   OK [message]
   ERROR [message]
0utput on fd1
(if --message xml)
   format not yet defined

Input: Information on what is to be backed up: A filesystem, device, particular set of files, database table, etc.

Action: Determines if there are any configuration problems.

Output: Success or failure.

Print-Command

Input: Information on what is to be backed up: A filesystem, device, particular set of files, database table, etc.

Output: Prints a one-line command, if one exists, to restore this data from tape. This can be used for non-Amanda bare-metal disaster recovery.