Camel.BlockFile

g Camel.BlockFile Camel.BlockFile GObject.Object GObject.Object GObject.Object->Camel.BlockFile

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (path, flags, version, block_size)

attach_block (bl)

delete ()

detach_block (bl)

free_block (id)

get_cache_limit ()

get_root ()

get_root_block ()

rename (path)

set_cache_limit (block_cache_limit)

sync ()

sync_block (bl)

touch_block (bl)

unref_block (bl)

Virtual Methods

Inherited:

GObject.Object (7)

do_init_root ()

do_validate_root ()

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Camel.BlockFile(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Camel.BlockFileClass

classmethod new(path, flags, version, block_size)
Parameters:
  • path (str) – a path with file name of the new Camel.BlockFile

  • flags (int) – file open flags to use

  • version (str) – a version string

  • block_size (int) – block size, currently ignored

Returns:

The new block file, or None if it could not be created.

Return type:

Camel.BlockFile or None

Allocate a new block file, stored at path. version contains an 8 character version string which must match the head of the file, or the file will be intitialised.

block_size is currently ignored and is set to Camel.BLOCK_SIZE.

attach_block(bl)
Parameters:

bl (Camel.Block) – a Camel.Block

Reattach a block that has been detached.

delete()
Returns:

0 on success, -1 on error.

Return type:

int

Deletes existing block file.

detach_block(bl)
Parameters:

bl (Camel.Block) – a Camel.Block

Detatch a block from the block file’s cache. The block should be unref’d or attached when finished with. The block file will perform no writes of this block or flushing of it if the cache fills.

free_block(id)
Parameters:

id (int) – a #camel_block_t

Return type:

int

get_cache_limit()
Returns:

Current block cache limit of self.

Return type:

int

New in version 3.24.

get_root()
Returns:

A Camel.BlockRoot of self.

Return type:

Camel.BlockRoot

New in version 3.24.

get_root_block()
Returns:

A root Camel.Block of self.

Return type:

Camel.Block

New in version 3.24.

rename(path)
Parameters:

path (str) – path with filename to rename to

Returns:

0 on success, -1 on error; errno is set on failure

Return type:

int

Renames existing block file to a new path.

set_cache_limit(block_cache_limit)
Parameters:

block_cache_limit (int) – a new block cache limit to set

Sets a new block cache limit for self.

New in version 3.24.

sync()
Returns:

-1 on io error.

Return type:

int

Sync all dirty blocks to disk, including the root block.

sync_block(bl)
Parameters:

bl (Camel.Block) – a Camel.Block

Returns:

-1 on io error.

Return type:

int

Flush a block to disk immediately. The block will only be flushed to disk if it is marked as dirty (touched).

touch_block(bl)
Parameters:

bl (Camel.Block) – a Camel.Block

Mark a block as dirty. The block will be written to disk if it ever expires from the cache.

unref_block(bl)
Parameters:

bl (Camel.Block) – a Camel.Block

Mark a block as unused. If a block is used it will not be written to disk, or flushed from memory.

If a block is detatched and this is the last reference, the block will be freed.

do_init_root() virtual
Return type:

int

do_validate_root() virtual
Return type:

int