Collaboration diagram for Files of Records:
![]() |
Pages in a file are slotted pages: Each page contains an array of slots. Records take one of three forms: small, large, and very large.
Because records may take these forms, the API for creating records contains the opportunity for you to provide a hint about the ultimate size of the record so that the storage manager can create the proper structure for the record immediately, rather than creating a small record that is soon to be converted to a large, then a very large record by subsequent appends.
All records contain a client-defined header. This is for the convenience of server-writers. The header must fit on the slotted page, so it should never be very large.
The following methods manipulate files of records and the records found there.
Modules below describe file traversal and appending to files (Scanning Files), and pinning individual records in the buffer pool for extended operations (Pinning Records).
zvec_t zdata(100000);
Modules | |
Pinning Records | |
Functions | |
static rc_t | ss_m::create_file (vid_t vid, stid_t &fid, store_property_t property, shpid_t cluster_hint=0) |
Create a file of records. | |
static rc_t | ss_m::destroy_file (const stid_t &fid) |
Destroy a file of records. | |
static rc_t | ss_m::create_rec (const stid_t &fid, const vec_t &hdr, smsize_t len_hint, const vec_t &data, rid_t &new_rid) |
Create a new record. | |
static rc_t | ss_m::destroy_rec (const rid_t &rid) |
Destroy a record. | |
static rc_t | ss_m::update_rec (const rid_t &rid, smsize_t start, const vec_t &data) |
Modify the body of an existing record. | |
static rc_t | ss_m::update_rec_hdr (const rid_t &rid, smsize_t start, const vec_t &hdr) |
Modify the header of an existing record. | |
static rc_t | ss_m::append_rec (const rid_t &rid, const vec_t &data) |
Append bytes to a record body. | |
static rc_t | ss_m::truncate_rec (const rid_t &rid, smsize_t amount) |
Chop bytes off the end of a record body. | |
static rc_t | ss_m::truncate_rec (const rid_t &rid, smsize_t amount, bool &should_forward) |
Chop bytes off the end of a record body. | |
rc_t | append_file_i::create_rec (const vec_t &hdr, smsize_t len_hint, const vec_t &data, rid_t &rid) |
Append a new record to the end of the file. |
static rc_t ss_m::create_file | ( | vid_t | vid, | |
stid_t & | fid, | |||
store_property_t | property, | |||
shpid_t | cluster_hint = 0 | |||
) | [static, inherited] |
Create a file of records.
[in] | vid | Volume on which to create a file. |
[out] | fid | Returns (store) ID of the new file here. |
[in] | property | Give the file the this property. |
[in] | cluster_hint | Not used. |
Destroy a file of records.
[in] | fid | ID of the file to destroy. |
static rc_t ss_m::create_rec | ( | const stid_t & | fid, | |
const vec_t & | hdr, | |||
smsize_t | len_hint, | |||
const vec_t & | data, | |||
rid_t & | new_rid | |||
) | [static, inherited] |
Create a new record.
[in] | fid | ID of the file in which to create a record. |
[in] | hdr | What to put in the record's header. |
[in] | len_hint | Hint about how big the record will ultimately be. This is used to determine the initial format of the record. If you plan to append to the record and know that it will ultimately become a large record, it is more efficient to give a size hint that is larger than a page here. Otherwise, the record will be made small (as determined by the size of the parameter data ), and subsequent appends will cause the record to be converted to a large record. |
[in] | data | What to put in the record's body. |
[out] | new_rid | ID of the newly created record. |
static rc_t ss_m::destroy_rec | ( | const rid_t & | rid | ) | [static, inherited] |
Destroy a record.
[in] | rid | ID of the record to destroy. |
static rc_t ss_m::update_rec | ( | const rid_t & | rid, | |
smsize_t | start, | |||
const vec_t & | data | |||
) | [static, inherited] |
Modify the body of an existing record.
[in] | rid | ID of the record to modify. |
[in] | start | First byte to change. |
[in] | data | What to put in the record's body. |
static rc_t ss_m::update_rec_hdr | ( | const rid_t & | rid, | |
smsize_t | start, | |||
const vec_t & | hdr | |||
) | [static, inherited] |
Modify the header of an existing record.
[in] | rid | ID of the record to modify. |
[in] | start | First byte to change. |
[in] | hdr | What to put in the record's header. |
Append bytes to a record body.
[in] | rid | ID of the record to modify. |
[in] | data | What to append to the record. |
static rc_t ss_m::truncate_rec | ( | const rid_t & | rid, | |
smsize_t | amount | |||
) | [static, inherited] |
Chop bytes off the end of a record body.
[in] | rid | ID of the record to modify. |
[in] | amount | How many bytes to lop off. |
static rc_t ss_m::truncate_rec | ( | const rid_t & | rid, | |
smsize_t | amount, | |||
bool & | should_forward | |||
) | [static, inherited] |
Chop bytes off the end of a record body.
[in] | rid | ID of the record to modify. |
[in] | amount | How many bytes to lop off. |
[out] | should_forward | Returns true if the record started out large but is now small as a result of the truncation. This enables a value-added server to take action in this event, should it so desire. |
rc_t append_file_i::create_rec | ( | const vec_t & | hdr, | |
smsize_t | len_hint, | |||
const vec_t & | data, | |||
rid_t & | rid | |||
) | [inherited] |
Append a new record to the end of the file.
[in] | hdr | The client-defined record header. |
[in] | len_hint | The length of the record, more or less. More accuracy here helps the sm reduce its work. |
[in] | data | The client-defined record contents. |
[out] | rid | The identifier of the new record. |