diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/utils/vmpi/vmpi_filesystem.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/utils/vmpi/vmpi_filesystem.h')
| -rw-r--r-- | mp/src/utils/vmpi/vmpi_filesystem.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/mp/src/utils/vmpi/vmpi_filesystem.h b/mp/src/utils/vmpi/vmpi_filesystem.h new file mode 100644 index 00000000..889d8abc --- /dev/null +++ b/mp/src/utils/vmpi/vmpi_filesystem.h @@ -0,0 +1,53 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef VMPI_FILESYSTEM_H
+#define VMPI_FILESYSTEM_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+#include "interface.h"
+
+
+class IFileSystem;
+class MessageBuffer;
+
+
+// Use this to read virtual files.
+#define VMPI_VIRTUAL_FILES_PATH_ID "VMPI_VIRTUAL_FILES_PATH_ID"
+
+
+// When you hook the file system with VMPI and are a worker, it blocks on file reads
+// and uses MPI to communicate with the master to transfer files it needs over.
+//
+// The filesystem, by default (and it maxFileSystemMemoryUsage is left at zero),
+// keeps the contents of the files that get opened in memory. You can pass in a
+// value here to put a cap on it, in which case it'll unload the least-recently-used
+// files when it hits the limit.
+IFileSystem* VMPI_FileSystem_Init( int maxFileSystemMemoryUsage, IFileSystem *pPassThru );
+
+// On the master machine, this really should be called before the app shuts down and
+// global destructors are called. If it isn't, it might lock up waiting for a thread to exit.
+//
+// This returns the original filesystem you passed into VMPI_FileSystem_Init so you can uninitialize it.
+IFileSystem* VMPI_FileSystem_Term();
+
+// Causes it to error out on any Open() calls.
+void VMPI_FileSystem_DisableFileAccess();
+
+// Returns a factory that will hand out BASEFILESYSTEM_INTERFACE_VERSION when asked for it.
+CreateInterfaceFn VMPI_FileSystem_GetFactory();
+
+// This function creates a virtual file that workers can then open and read out of.
+// NOTE: when reading from the file, you must use VMPI_VIRTUAL_FILES_PATH_ID as the path ID
+// or else it won't find the file.
+void VMPI_FileSystem_CreateVirtualFile( const char *pFilename, const void *pData, unsigned long fileLength );
+
+
+#endif // VMPI_FILESYSTEM_H
|