Crate gluster [−] [src]
This is a library to interface with Gluster
Most of the commands below are wrappers around the CLI functionality. However recently I have reverse engineered some of the Gluster RPC protocol so that calls can be made directly against the Gluster server. This method of communication is much faster than shelling out.
Scale testing with this library has been done to about 60 servers successfully.
Please file any bugs found at: Gluster Repo Pull requests are more than welcome!
Structs
Brick |
A Gluster Brick consists of a Peer and a path to the mount point |
BrickStatus | |
Peer |
A Gluster Peer. A Peer is roughly equivalent to a server in Gluster. |
Quota |
A Quota can be used set limits on the pool usage. All limits are set in bytes. |
Volume |
A volume is a logical collection of bricks. Most of the gluster management operations happen on the volume. |
Enums
AccessMode | |
GlusterError |
Custom error handling for the library |
GlusterOption | |
SelfHealAlgorithm | |
State |
A enum representing the possible States that a Peer can be in |
Toggle | |
Transport |
An enum to select the transport method Gluster should use for the Volume |
VolumeTranslator | |
VolumeType |
These are all the different Volume types that are possible in Gluster Note: Tier is not represented here because I'm waiting for it to become more stable For more information about these types see: Gluster Volume |
Functions
get_local_hostname |
A function to get the information from /etc/hostname |
get_local_ip |
Returns the local IPv4Addr address associated with this server |
get_peer |
This will query the Gluster peer list and return a Peer struct for the peer |
get_quota_usage |
Returns a u64 representing the bytes used on the volume. Note: This uses my brand new RPC library. Some bugs may exist so use caution. This does not shell out and therefore should be significantly faster. It also suffers far less hang conditions than the CLI version. |
ok_to_remove |
Based on the replicas or erasure bits that are still available in the volume this will return True or False as to whether you can remove a Brick. This should be called before volume_remove_brick() |
peer_list |
Runs gluster pool list and returns a Vec |
peer_probe |
Adds a new peer to the cluster by hostname or ip address |
peer_remove |
Removes a peer from the cluster by hostname or ip address |
peer_status |
Runs gluster peer status and returns a Vec |
quota_list |
Return a list of quotas on the volume if any |
resolve_to_ip |
Resolves a &str hostname into a ip address. |
translate_to_bytes |
This is a helper function to convert values such as 1PB into a bytes |
volume_add_brick |
This adds a new brick to the volume |
volume_add_quota |
Adds a size quota to the volume and path. |
volume_create_distributed |
This creates a new distributed volume |
volume_create_erasure |
This creates a new erasure coded volume |
volume_create_replicated |
This creates a new replicated volume |
volume_create_striped |
This creates a new striped volume |
volume_create_striped_replicated |
This creates a new striped and replicated volume |
volume_delete |
This deletes a stopped volume |
volume_disable_quotas |
Disable quotas on the volume |
volume_enable_quotas |
Enable quotas on the volume |
volume_info |
Returns a Volume with all available information on the volume |
volume_list |
Lists all available volume names. |
volume_quotas_enabled |
Check if quotas are already enabled on a volume |
volume_rebalance |
This function doesn't do anything yet. It is a place holder because volume_rebalance is a long running command and I haven't decided how to poll for completion yet |
volume_remove_brick |
This will remove a brick from the volume |
volume_remove_quota |
Removes a size quota to the volume and path. |
volume_set_options |
Set an option on the volume |
volume_start |
Once a volume is created it needs to be started. This starts the volume |
volume_status |
Query the status of the volume given. |
volume_stop |
This stops a running volume |