2004-06-25 18:59:24 +00:00
|
|
|
#ifndef __BLOB_MANAGER_H
|
|
|
|
#define __BLOB_MANAGER_H
|
|
|
|
|
2007-06-11 21:36:57 +00:00
|
|
|
#include <stasis/common.h>
|
2008-04-13 04:02:57 +00:00
|
|
|
#include <stasis/page.h>
|
2004-06-25 18:59:24 +00:00
|
|
|
BEGIN_C_DECLS
|
|
|
|
|
2004-06-28 21:10:10 +00:00
|
|
|
/**
|
|
|
|
@file
|
2004-07-06 20:59:36 +00:00
|
|
|
blobManager - Provides blob handling.
|
|
|
|
|
2004-06-25 18:59:24 +00:00
|
|
|
Plan for modularity: Exactly one blob manager per storeFile.
|
2004-07-06 20:59:36 +00:00
|
|
|
Alternatively, we could use the bufferManager's record length
|
|
|
|
field to allow for more than one blob manager per buffer
|
|
|
|
manager. (Right now, this field is set to a special value for
|
|
|
|
blobs; thie could be extended for other types of records.)
|
|
|
|
|
2004-06-25 18:59:24 +00:00
|
|
|
Blob manager interacts with page manger via page manager's
|
|
|
|
public api.
|
2004-06-28 21:10:10 +00:00
|
|
|
|
|
|
|
Blob updates work as follows:
|
|
|
|
|
|
|
|
(1) A transaction obtains an exclusive write lock on a blob
|
|
|
|
(not implemented yet.)
|
|
|
|
|
|
|
|
(2) When it requests a write, the blob it writes to is added to
|
|
|
|
a data structure that lists all dirty blobs by transaction,
|
|
|
|
and the page containing the blob entry is updated. (The fd
|
|
|
|
bit in the record is flipped, and the LSN is updated.) The
|
|
|
|
write to the blob store is not flushed to disk.
|
|
|
|
|
|
|
|
(3) All subsequent writes to the same blob just update the
|
|
|
|
backing file.
|
|
|
|
|
|
|
|
(4) On commit and rollback, the data structure containing the xid's
|
|
|
|
dirty blobs is destroyed.
|
|
|
|
|
|
|
|
(5) recovery2.c handles the restoration of the fd bits using
|
|
|
|
physical logging (this is automatic, since we use Tset()
|
|
|
|
calls to update the records.)
|
2007-06-01 21:06:18 +00:00
|
|
|
|
2004-07-04 00:46:49 +00:00
|
|
|
@todo Set range??
|
|
|
|
|
2007-07-18 20:09:14 +00:00
|
|
|
@todo Update blobManager to (partially) provide a page api
|
|
|
|
|
2008-09-28 03:11:24 +00:00
|
|
|
@todo Move blobManager to page and/or operations directory
|
|
|
|
|
2004-07-04 00:46:49 +00:00
|
|
|
@ingroup LLADD_CORE
|
2004-06-25 18:59:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2004-06-28 22:48:02 +00:00
|
|
|
Read the blob from the recordid rid into buf.
|
2004-06-25 18:59:24 +00:00
|
|
|
*/
|
2011-06-13 11:26:25 +00:00
|
|
|
void stasis_blob_read(int xid, Page * p, recordid rid, byte * buf);
|
2004-06-28 21:10:10 +00:00
|
|
|
|
2004-06-25 18:59:24 +00:00
|
|
|
|
|
|
|
/**
|
2004-06-28 22:48:02 +00:00
|
|
|
Write the contents of buf to the blob in recordid rid.
|
2004-06-25 18:59:24 +00:00
|
|
|
*/
|
2011-06-13 11:26:25 +00:00
|
|
|
void stasis_blob_write(int xid, Page * p, recordid rid, const byte * buf);
|
2004-06-28 21:10:10 +00:00
|
|
|
|
2011-06-12 08:13:34 +00:00
|
|
|
recordid preAllocBlob(int xid, long blobsize);
|
|
|
|
recordid preAllocBlobFromPage(int xid, long page, long blobsize);
|
2004-06-30 01:09:57 +00:00
|
|
|
|
2004-06-28 22:48:02 +00:00
|
|
|
/**
|
|
|
|
Allocate a blob of size blobSize.
|
|
|
|
*/
|
2004-06-30 01:09:57 +00:00
|
|
|
|
2009-05-08 06:53:30 +00:00
|
|
|
void stasis_blob_alloc(int xid, recordid rid);
|
|
|
|
void stasis_blob_dealloc(int xid, blob_record_t* r);
|
2004-06-25 18:59:24 +00:00
|
|
|
|
2009-05-08 06:53:30 +00:00
|
|
|
page_impl stasis_page_blob_impl();
|
2007-07-18 20:09:14 +00:00
|
|
|
|
2004-06-25 18:59:24 +00:00
|
|
|
END_C_DECLS
|
|
|
|
|
|
|
|
#endif
|