Plasma GitLab Archive
Projects Blog Knowledge

Class type Nn_state.shared_state_t


class type shared_state_t = object .. end
This object exists once in the nn_master container, and collects information from not yet committed views (such as which ID's are used), so that the views can avoid clashes between each other. Also caching of committed values.

method event_system : Unixqueue.event_system
The common event system
method node_config : Nn_config.nn_node_config
the configuration
method cur_rev_ident : string
Returns current revision identifier
method new_rev_ident : unit -> string
Creates a new revision identifier
method set_rev_ident : string -> unit
Sets the identitifer returned by cur_rev_ident
method datastore_max_id : int option
Maximum ID used in the datastore table (None if use_id was never called)
method datastore_use_id : int -> unit
Record that this ID is now also used in a transaction
method inode_max_id : int64 option
Maximum ID used in the inode table (None if use_id was never called)
method inode_use_id : int64 -> unit
Record that this ID is now also used in a transaction
method inode_get_new_id_serialized : (Unixqueue.event_system -> int64 Uq_engines.engine) ->
int64 Uq_engines.engine
Serializer for getting a new ID from the inode table
method commit_monitor : Nn_commit_monitor.commit_monitor
The commit monitor controls which commits can be run in parallel
method slaves : (string * Rpc_proxy.ManagedClient.mclient * bool) list
Connections to the name slaves as triples (name,client,enabled). These must only be used in the commit protocol.
method disable_slave : string -> unit
disable_slave name
method is_slave_disabled : string -> bool
Whether this slave is disabled
method minimum_slaves : int
How many enabled slaves we need at minimum
method enough_slaves : bool
Whether there are still enough enabled slaves
method master : string
The master in host:port syntax
method master_enabled : bool
Whether the master (i.e. this process) is still in sync with the rest
method disable_master : unit -> unit
Disable this master
method blockmaps : Nn_blockmap.blockmap_t list
All blockmaps so far loaded
method get_blockmap : string -> Nn_blockmap.blockmap_t
Get the blockmap for this identity, or Not_found
method blockmap_get_e : identity:string -> Nn_blockmap.blockmap_t Uq_engines.engine
If the blockmap exists, return it. If it does not exist, load it from the db. Loading is serialized if several users need the blockmap.
method blockmap_serialized : int64 list ->
(Unixqueue.event_system -> unit Uq_engines.engine) -> unit Uq_engines.engine
This is used to synchronize accesses to the in-memory blockmap with the per-inode blocklists in the db. The passed list are the inodes that are affected by the serialized operation.

Currently we have here inode granularity (each inode has a separate lock). A possible improvement would be reader/writer locks.

method forget_identity : string -> unit
Forget everything about this datastore identity
method lock_inode : int64 -> owner -> (unit -> unit) option
Returns Some unlock if successful where calling unlock removes the lock, or reverts to the previous state (1-step undo)
method unlock_inodes : owner -> unit
unlock all inodes of this owner
method lock_filename : int64 * string ->
[ `Exists | `Link | `Unlink ] -> owner -> (unit -> unit) option
lock_filename (dir_inode,name) lock_type owner: Locks the name member of directory dir_inode.

Lock types:

  • `Link: States that the file is created, and must not be created by another transaction. A `Link lock is exlusive.
  • `Unlink: States that the file is removed, and must not be removed by another transaction. An `Unlink lock is exclusive.
  • `Exists: States that the file exists. Several transactions can request this. (Used for ensuring that parent directories exist until the end of the transaction.)
Certain lock type changes are allowed provided this is ok with the protected operations (e.g. from `Unlink to `Link). It is also possible that a lock already exists with stronger guarantees (e.g. we have already `Link which implies `Exists).

Returns Some unlock if successful where calling unlock removes the lock, or reverts to the previous state (1-step undo).

method unlock_filenames : owner -> unit
unlock all filenames of this owner
method inode_modify_use_counts : transactions:(int -> int) -> int64 -> unit
The use count for inodes:

  • transactions: number of open transactions (no matter whether the transaction is reading or writing to the inode)
This functions modifies these counts.

If transactions drops to 0, the entry is automatically removed.

method inode_use_counts : int64 -> int
Returns (transactions) numbers (or raises Not_found)
method zombie_inodes_exist : bool
Whether zombie inodes exist (unused anonymous inodes)
method set_zombie_inodes : bool -> unit
Set whether zombie inodes exist
method cauth : Pfs_auth.client_auth
Return the cauth record
method db_trans_for_commit : unit -> Nn_db.transaction
Returns the db transaction that is used for commits
method incr_count : counter_name -> unit
Increases this shared counter
method reset_count : counter_name -> int
Resets this shared counter, and returns the value before resetting
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml