NDB Cluster Internals  /  NDB Kernel Blocks  /  The NDBFS Block

4.15 The NDBFS Block

This block provides the NDB file system abstraction layer, and is located in the directory storage/ndb/src/kernel/blocks/ndbfs, which contains the following files:

  • AsyncFile.hpp: Defines the AsyncFile class, which represents an asynchronous file. All actions are executed concurrently with the other activities carried out by the process. Because all actions are performed in a separate thread, the result of an action is sent back through a memory channel. For the asyncronous notification of a finished request, each callincludes a request as a parameter. This class is used for writing or reading data to and from disk concurrently with other activities.

  • AsyncFile.cpp: Defines the actions possible for an asynchronous file, and implements them.

  • Filename.hpp: Defines the Filename class. Takes a 128-bit value (as a array of four longs) and makes a file name out of it. This file name encodes information about the file, such as whether it is a file or a directory, and if the former, the type of file. Possible types include data file, fragment log, fragment list, table list, schema log, and system file, among others.

  • Filename.cpp: Implements set() methods for the Filename class.

  • MemoryChannelTest/MemoryChannelTest.cpp: Basic program for testing reads from and writes to a memory channel (that is, reading from and writing to a circular buffer).

  • OpenFiles.hpp: Implements an OpenFiles class, which provides some convenience methods for determining whether or not a given file is already open.

  • VoidFs.cpp: Used for diskless operation. Generates a dummy acknowledgment to write operations.

  • CircularIndex.hpp: The CircularIndex class, defined in this file, serves as the building block for implementing circular buffers. It increments as a normal index until it reaches maximum size, then resets to zero.

  • CircularIndex.cpp: Contains only a single #define, not actually used at this time.

  • MemoryChannel.hpp: Defines the MemoryChannel and MemoryChannelMultipleWriter classes, which provide a pointer-based channel for communication between two threads. It does not copy any data into or out of the channel, so the item that is put in can not be used untill the other thread has given it back. There is no support for detecting the return of an item.

  • MemoryChannel.cpp: Dummy file, not used at this time.

  • Ndbfs.hpp: Because an NDB signal request can result in multiple requests to AsyncFile, one class (defined in this file) is responsible for keeping track of all outstanding requests, and when all are finished, reporting the outcome back to the sending block.

  • Ndbfs.cpp: Implements initialization and signal-handling methods for the Ndbfs class.

  • Pool.hpp: Creates and manages a pool of objects for use by Ndbfs and other classes in this block.

  • AsyncFileTest/AsyncFileTest.cpp: Test program, used to test and benchmark functionality of AsyncFile.