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 |
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
GlusterError |
Custom error handling for the library |
State |
A enum representing the possible States that a Peer can be in |
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 FailuresReturns a GlusterError representing any failure that may have happened while trying to query this information. |
get_peer |
This will query the Gluster peer list and return a Peer struct for the peer FailuresReturns GlusterError if the peer could not be found |
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. FailuresWill return GlusterError if the RPC fails |
peer_list |
Runs gluster pool list and returns a Vec FailuresReturns GlusterError if the command failed to run |
peer_probe |
Adds a new peer to the cluster by hostname or ip address FailuresReturns GlusterError if the command failed to run |
peer_remove |
Removes a peer from the cluster by hostname or ip address FailuresReturns GlusterError if the command failed to run |
peer_status |
Runs gluster peer status and returns a Vec FailuresReturns GlusterError if the command failed to run |
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 Examplesextern crate gluster; let bytes = gluster::translate_to_bytes("1GB").unwrap(); assert_eq!(bytes, 1073741824); |
volume_add_brick |
This adds a new brick to the volume FailuresWill return GlusterError if the command fails to run |
volume_add_quota |
Adds a size quota to the volume and path. FailuresWill return GlusterError if the command fails to run |
volume_create_distributed |
This creates a new distributed volume FailuresWill return GlusterError if the command fails to run |
volume_create_erasure |
This creates a new erasure coded volume FailuresWill return GlusterError if the command fails to run |
volume_create_replicated |
This creates a new replicated volume FailuresWill return GlusterError if the command fails to run |
volume_create_striped |
This creates a new striped volume FailuresWill return GlusterError if the command fails to run |
volume_create_striped_replicated |
This creates a new striped and replicated volume FailuresWill return GlusterError if the command fails to run |
volume_delete |
This deletes a stopped volume FailuresWill return GlusterError if the command fails to run |
volume_disable_quotas |
Disable quotas on the volume FailuresWill return GlusterError if the command fails to run |
volume_enable_quotas |
Enable quotas on the volume FailuresWill return GlusterError if the command fails to run |
volume_info |
Returns a Volume with all available information on the volume FailuresWill return GlusterError if the command failed to run. |
volume_list |
Lists all available volume names. FailuresWill return None if the Volume list command failed or if volume could not be transformed into a String from utf8 |
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 FailuresWill return GlusterError if the command fails to run |
volume_start |
Once a volume is created it needs to be started. This starts the volume FailuresWill return GlusterError if the command fails to run |
volume_stop |
This stops a running volume FailuresWill return GlusterError if the command fails to run |