Application API/Operations

From wiki.zmanda.com
Revision as of 21:46, 3 February 2009 by Nikolas (talk | contribs) (Make references a bit more specific →‎'''support''' command)
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

Note that all property names will be folded to lowercase and have underscores converted to dashes. Property values will be in the same case they were in the configuration file, but may be escaped (e.g. the tab character replaced with \t, and so on, with \ being represented by \\)

Information about what to be backed up is specified by --device, --include-file, --include-list, --exclude-file, and --exclude-list. --level is used to support incremental backups. --level 0 signifies a base/full backup. --level 1 builds on level 0, 2 builds on 1, and so on.

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

This command informs Amanda about the capabilities of this application. Try to provide as much information as possible so Amanda doesn't have to make as many assumptions.

Most parameters should use either YES or NO for their values. Names and values must be separated by exactly one space.

Parameter Default Description
CONFIG YES Is the --config option supported?
HOST YES Is the --host option supported? See also: disklist(5)
DISK YES Is the --disk option supported? See also: disklist(5)
MAX-LEVEL 0 An integer. The maximum "depth" of incremental backups. This can not be greater than 10.
INDEX-LINE NO Is line-based indexing (--index line) supported?
INDEX-XML NO Is XML indexing (--index line) supported?
MESSAGE-LINE NO Is line-based message output (--message line) supported?
MESSAGE-XML NO Is XML message output (--message xml) supported?
RECORD NO Is the --record option supported?
INCLUDE-FILE NO Is the --include-file property supported? See also: include in amanda.conf(5)
INCLUDE-LIST NO Is the --include-list property supported? See also: include in amanda.conf(5)
INCLUDE-OPTIONAL NO
EXCLUDE-FILE NO Is the exclude-file property supported? See also: exclude in amanda.conf(5)
EXCLUDE-LIST NO Is the exclude-list property supported? See also: exclude in amanda.conf(5)
EXCLUDE-OPTIONAL NO
COLLECTION NO
CALCSIZE NO Does the estimate command support the --calcsize option?
MULTI-ESTIMATE NO
RECOVER-MODE If set to SMB, sambaclient will be used during recovery

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)
   | normal/informative message
   ? error/strange message
   & unknown/unrecognized message
   sendbackup: HEADER variable=value, information that should go in the amanda header.
   sendbackup: SIZE value suffix where suffix could be K, (kilobytes) M, (megabytes) or G (gigabytes)
   sendbackup: END
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)
XXX User:Martineau: Is header implemented? How does restore get this information

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|中文(中国大陆)]]}}|}}


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

Action: Creates a backup (of --level) of the specified object.

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

XXX User:Martineau: Are collections facilitated by multiple size lines?

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|中文(中国大陆)]]}}|}}


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.

XXX User:Martineau: Is this implemented?

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|中文(中国大陆)]]}}|}}


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.
   level num_blocks block_size
 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. block_size is optional. If absent, it defaults to 1. The total size of the backup is num_blocks*block_size

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 messages

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.

XXX User:Martineau: Is this implemented?

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|中文(中国大陆)]]}}|}}