[AFS3-std] Directory Listing RPC v2, pre-discussion

Matt W. Benjamin matt@linuxbox.com
Thu, 24 Sep 2009 05:31:10 -0400 (EDT)


Hi,

Here's a next directory listing RPC concept, which aims to incorporate feedback from Jhutz, Tkeiser, and Marcus.  I haven't yet included the concept of optional notification sequences, but expect to cover it in discussion.

Thanks,

Matt


Matt Benjamin

FetchDirectory RPC

September 24, 2009

Abstract

A new split RPC for implementation-independent directory listing 
is defined. The implementation is stateful, returning a 
versioned, opaque iterator to follow related calls. The design 
considers very long file names, arbitrary name encoding, and 
sorting.

/* names */

const AFS_UC_NAMEMAX = 4096;

typedef string AFSUCName<4096>;



/* sorting */

const AFS_UC_COLLATION_UNSORTED = 0;

const AFS_UC_COLLATION_UNKNOWN_SORTED = 1;



/* listing iterator */

struct DirIterator {

  afs_uint32 Type; /* prevent some acc. misuses */

  afs_uint32 Flags;

  opaque Cursor<1024>;

};



/* Directory Entry*/

const AFS_DIRNAME_LEGACY = 0;

const AFS_DIRNAME_WSHORT = 1;

const AFS_DIRNAME_UNICODE = 2;



/* suggested directory entry format */

const AFS_FS_DIRENTRY = 1;

struct AFSFSDirEntry {

  AFSFid Fid;

  AFSUCName Names<>; /* indexed by defined name types */

};



/* union of supported formats */

union AFSDirEntry switch (afs_uint32 Entry_Type) {

  case AFS_FS_DIRENTRY:

    AFSDirEntry;

  };



/* each read from the split stream produces a length an 
XDR-encoded

   segment */

const FetchDir_Fetch_Abort = 0x0001;

const FetchDir_Fetch_Changed = 0x0001;



struct DirListingSegment {

  afs_uint32 Flags;

  string DirEntry<>;

};



/* RPC definition */

const FetchDir_Result_Ok = 0;



proc FetchDirectory(

  IN 

    AFSFid *DirFid,

  INOUT

    afs_uint32 Flags;

    afs_uint32 Collation,

    afs_uint64 NTotalEntries,

    DirIterator *Iterator,

  OUT

    AFSFetchStatus *OutStatus,

    AFSCallBack *CallBack,

    AFSVolSync *Sync

    } = AFS_FETCH_DIRECTORY_ORD;



-- 

Matt Benjamin

The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI  48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309