-- FT.mesa
-- Interface to the File Transfer component of the
-- Mike Schroeder September 7, 1982 11:16 am

DIRECTORY
  Rope: TYPE USING [ROPE],
  File: TYPE USING [Capability],
  LSD: TYPE USING [Entry];

FT: DEFINITIONS = {

-- Exceptional conditions are reported with CIFS.Error


  OpenFile: TYPE = REF FileObject;

  FileObject: TYPE = RECORD [
    fc: File.Capability,
    entry: LSD.Entry,
    mode: Mode,
    name: Rope.ROPE,
    oldFile: BOOLEAN
    ];

  Mode: TYPE = CARDINAL;
  read: Mode = 1;
  write: Mode = 2;
  create: Mode = 4;
  replace: Mode = 8;
  dontCheck: Mode = 16;

-- file open and close

  Open: PROC[name: Rope.ROPE, mode: Mode]
    RETURNS[fh: OpenFile];
      -- Open a file
      -- name is a full path name of the form "/host/dir1/.../dirn/entryname"
      -- A capability for the file can be found in fh.fc
      -- Sets locks according to mode.

  Close: PROC [fh: OpenFile];
      -- Close a file.


-- utilities

  Connect: PROC[name: Rope.ROPE, password: Rope.ROPE];
      -- Set credentials

  Delete: PROC[name: Rope.ROPE];
      -- Delete a file
      
  GetBaseFreeSpace: PROC RETURNS[pages: INT];
      -- Gets the number of free pages that should be maintained
      -- on the local disk

  Login: PROC[name: Rope.ROPE, password: Rope.ROPE];
      -- Set credentials

  Rename: PROC[from: Rope.ROPE, to: Rope.ROPE];
      -- Rename file
      
  Reset: PROC[name: Rope.ROPE];
      -- Reset a file from its backing store
      -- Accomplished by invalidating local copy.
      
  SetBaseFreeSpace: PROC[pages: INT ← 0];
      -- Sets the number of free pages that should be maintained
      -- on the local disk
      -- If pages is omitted, FT will just ensure that there are
      -- enough free pages according to the current setting
     
  Swap: PROC[filea: Rope.ROPE, fileb: Rope.ROPE];
      -- Swap the contents of filea and fileb

  ExplicitBackup: PROC[name: Rope.ROPE]
    RETURNS[version: INT];
      -- Store a file and return its version number
      -- 0 is returned if the file on the server is current
      --  than the server, and no store is done

}..