org.jmythapi.protocol.response
Interface IFreeSpaceList

All Superinterfaces:
IBasicFreeSpace, Iterable<IFreeSpaceListEntry>, IVersionable
All Known Implementing Classes:
FreeSpaceList

public interface IFreeSpaceList
extends Iterable<IFreeSpaceListEntry>, IBasicFreeSpace, IVersionable

The response to a IBackend.queryFreeSpaceList(boolean) request.

Request example:


    // query freespace for all hosts
    IFreeSpaceList freeSpaceList = backend.queryFreeSpaceList(true);
    
    // print the summary
    System.out.println(String.format(
       "MythTV has used %s space out of %s used on %d storage groups.",
       EncodingUtils.getFormattedFileSize(freeSpaceList.getUsedSpace()),
       EncodingUtils.getFormattedFileSize(freeSpaceList.getTotalSpace()),
       freeSpaceList.size()
    ));
    
    // print details for each storage group
    for (IFreeSpaceListEntry entry : freeSpaceList) {
       System.out.println(String.format(
          "- %s : %s space out of %s used",
          entry.getDirectories(),
          EncodingUtils.getFormattedFileSize(entry.getUsedSpace()),
          EncodingUtils.getFormattedFileSize(entry.getTotalSpace())
       ));
    }
 
The above example will output, e.g.
 MythTV has used 3,17 GB space out of 3,72 GB used on 2 storage groups.
 - [mythbox:/mnt/data/mythpinky] : 3,14 GB space out of 3,58 GB used
 - [mythbox:/var/lib/mythtv/livetv, mythbox:/var/lib/mythtv/recordings] : 28,00 MB space out of 137,93 MB used
 

Response Example:

<00>HOSTNAME: mythbox | <01>DIRECTORIES: mythbox:/mnt/data/mythpinky | <02>IS_LOCAL: false | <03>FILESYSTEM_ID: 1 | <04>STORAGE_GROUP_ID: 12 | <05>BLOCK_SIZE: 131072 | <06>TOTAL_SPACE1: 0 | <07>TOTAL_SPACE2: 1922845568 | <08>USED_SPACE1: 0 | <09>USED_SPACE2: 1814276224
<00>HOSTNAME: mythbox | <01>DIRECTORIES: mythbox:/var/lib/mythtv/livetv,mythbox:/var/lib/mythtv/recordings | <02>IS_LOCAL: true | <03>FILESYSTEM_ID: 2 | <04>STORAGE_GROUP_ID: 11 | <05>BLOCK_SIZE: 4096 | <06>TOTAL_SPACE1: 0 | <07>TOTAL_SPACE2: 144629480 | <08>USED_SPACE1: 0 | <09>USED_SPACE2: 43545660

See Also:
IBackend.queryFreeSpaceList(boolean), QUERY_FREE_SPACE_LIST

Method Summary
 List<IFreeSpaceListEntry> asList()
          Returns a list, containing one entry for each backend storage-group.
 IFreeSpaceListEntry get(int idx)
          Gets the entry at the given index.
 Long getFreeSpace()
          Gets the free space on file system.
 Long getTotalSpace()
          Gets the total space on file system.
 Long getUsedSpace()
          Gets the used space on file system.
 int size()
          Returns the number of entries contained in this list
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.jmythapi.IVersionable
getVersionNr
 

Method Detail

getTotalSpace

Long getTotalSpace()
Gets the total space on file system.

Specified by:
getTotalSpace in interface IBasicFreeSpace
Returns:
total space

getUsedSpace

Long getUsedSpace()
Gets the used space on file system.

Specified by:
getUsedSpace in interface IBasicFreeSpace
Returns:
used space

getFreeSpace

Long getFreeSpace()
Gets the free space on file system.

Specified by:
getFreeSpace in interface IBasicFreeSpace
Returns:
free space

asList

List<IFreeSpaceListEntry> asList()
Returns a list, containing one entry for each backend storage-group.

Returns:
a list of entries.

get

IFreeSpaceListEntry get(int idx)
Gets the entry at the given index.

Parameters:
idx - the index of the entry
Returns:
the entry

size

int size()
Returns the number of entries contained in this list

Returns:
the list size


Copyright © 2008-2013. All Rights Reserved.