Overview
The FineFS protocol is inspired by HTTP. It's a clear text communication, where instructions are separated by carriage-returns, and some commands have an header an a body (separated by two carriage-returns).
The first line of every request contains a command name, a space, and the bore file's name. After there could be any number of lines, each one with an instruction, a colon, a space, and the associated information.
Example :
RENAME foo/bar/file
newfile: foo/bar/file2
origin: server1.domain.com
Responses are very simple. The first line may contain « OK » or « ERR » + space + error details. Some requests' responses contain an header and a body.
Commands
HELO
This command could be used to check some informations. Called with the client's host name as parameter, the server returns its own name, the used protocol version, and if the client is part of the cluster (active node) or not (passive node).
PUTHEAD
This command is only used by server-to-server communication.
When a server receives some file data, it sends a PUTHEAD command to the next server, which contains all file's metadata.
When a server receives a PUTHEAD command, it begins to delete all data related to the pointed file (metadata and binary), if needed. Then it stores the received metadata on the dedicated tree, and forwards the command to the next server. When a PUTHEAD command come back to its originator server, it is discarded.
PUTDATA
This command is used to send a file to a FineFS node. It could come from a local application or another node.
A PUTDATA request's header is similar to the one of a PUTHEAD request. When the destination server reads the request's header, and has verified its validity, it returns a « GO » line. When the submitter receives this line, it send the binary content of the file.
When a server receives a valid PUTDATA command, it begins to delete all data related to the pointed file (metadata and binary), if needed. Then it writes the new data to disk, and add a reference to the file in the log.
GETHEAD
This command is used to get information about a file (but not the file content). It is never user for server-to-server communication.
The response contains a header with all file's metadata.
GETDATA
This command works the same way than GETHEAD, excepted that it also returns the binary content of the request file (in the reponse's body). It could be used by applications to get the content of a file, and by servers to fetch a file of which they have only the metadata.
LIST
This command is used only for client-to-server communication, to get the list of files matching a pattern. The pattern may contains escaping characters (like a star to replace any string).
The response contains a list of files' metadata, each one separated by an empty line.
DEL
This command can be used by servers or applications.
The pointed file is deleted, and the command is forwarded to the next server. These operations are done even if the file isn't known locally. The processing is discarded when the command come back to its originator.
RENAME
This command can be used by server or applications.
The pointed file is renamed, using the new name given in the request's header. If the file's binary content is not localy available, it is fetched first, and the renamed. After that, the command is forwarded to the next server.
See also
How FineFS works: