File_Mogile
[ class tree: File_Mogile ] [ index: File_Mogile ] [ all elements ]

Class: File_Mogile

Source Location: /File_Mogile-0.2.0/File/Mogile.php

Class Overview


An interface for accessing MogileFS.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 41]
An interface for accessing MogileFS.

MogileFS is an open source distributed filesystem. MogileFS can be configured to provide high capacity, high availability, or a combination of both, as required by various classes of files.



[ Top ]


Class Variables

$commandTimeout =  4

[line 74]

Timeout for commands to MogileFS.

Currently used for CURL_TIMEOUT.

  • Var: Timeout in seconds, default 4.
  • Access: public

Type:   int


[ Top ]

$hosts = array()

[line 95]

Tracker hosts.
  • Access: protected

Type:   array


[ Top ]

$socketTimeout =  0.01

[line 48]

Timeout for establishing socket connection to tracker.
  • Var: Timeout in seconds, default 0.01.
  • Access: public

Type:   float


[ Top ]

$streamTimeoutMicroSeconds =  0

[line 66]

Timeout for each stream read from tracker in microseconds.

This is combined with {$streamTimeoutSeconds}


Type:   int


[ Top ]

$streamTimeoutSeconds =  1

[line 57]

Timeout for each stream read from tracker. This is combined with {$streamTimeoutMicroSeconds}

Type:   int


[ Top ]



Method Detail

__construct (Constructor)   [line 106]

File_Mogile __construct( array $hosts, [string $domain = null], [array $options = null])

Constructor.
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

array   $hosts   —  Array of trackers as 'hostname:port'
string   $domain   —  The mogile domain.
array   $options   —  Optional. Array of option values.

[ Top ]

__destruct (Destructor)   [line 626]

void __destruct( )

Destructor, closes socket.
  • Access: public

[ Top ]

connect   [line 143]

void connect( )

Make a connection to a random host
  • Throws: File_Mogile_Exception if no tracker connections succeed
  • Access: public

[ Top ]

curlExec   [line 582]

mixed curlExec( resource $ch)

curlExec
  • Return: result of curl_exec()
  • Access: protected

Parameters:

resource   $ch   —  Curl resource created via curl_init()

[ Top ]

delete   [line 328]

void delete( string $key)

Delete by key.
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $key   —  Mogile key.

[ Top ]

getDomains   [line 286]

array getDomains( )

Get domains.
  • Return: array('domain'=>array('class'=>N, ...), ...)
  • Throws: File_Mogile_Exception
  • Access: public

[ Top ]

getFileData   [line 432]

string getFileData( string $key)

Get data by key.
  • Return: data
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $key   —  The mogile key.

[ Top ]

getPaths   [line 313]

array getPaths( string $key)

Get paths for key.
  • Return: paths
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $key   —  Mogile key.

[ Top ]

listKeys   [line 358]

array listKeys( [string $prefix = ''], [string $after = null], [int $limit = 1000])

List key.
  • Return: array({next after}, array({keys}))
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $prefix   —  List only keys matching this prefix.
string   $after   —  The first key returned is the one after this, or the first if null.
int   $limit   —  The maximum number of keys returned.

[ Top ]

passthru   [line 463]

void passthru( mixed $destination)

Stream data by key or URL list.
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

mixed   $destination   —  The mogile key or array of URLs.

[ Top ]

passthruFileData   [line 502]

void passthruFileData( string $key)

Stream data by key.
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $key   —  The mogile key.

[ Top ]

rename   [line 342]

void rename( string $from, string $to)

Rename by key.
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $from   —  The key of the file to be renamed.
string   $to   —  The file's new key.

[ Top ]

reproxy   [line 399]

void reproxy( mixed $destination)

Reproxy by key or URL list.

Sends headers and exits on success. If the argument is a string, it is taken to be a key. If the argument is an array, it is taken to be the paths (URLs).

  • Throws: File_Mogile_Exception on invalid $destination
  • Access: public

Parameters:

mixed   $destination   —  The mogile key or array of URLs.

[ Top ]

sendReproxyHeader   [line 418]

void sendReproxyHeader( array $paths)

Sends the X-Reproxy-URL header and exists. Abstracted for testing.
  • Access: protected

Parameters:

array   $paths   —  Array of paths

[ Top ]

socketClose   [line 223]

void socketClose( )

Close the local socket if it's open
  • Access: protected

[ Top ]

socketConnect   [line 184]

void socketConnect( mixed $ip, mixed $port, mixed &$errorNumber, mixed &$error)

Make a socket connection via fsockopen. Abstracted for testing.
  • Access: protected

Parameters:

mixed   $ip   —  Tracker IP address
mixed   $port   —  Tracker Port number
mixed   &$errorNumber   —  Error Number Variable
mixed   &$error   —  Error Message Variable

[ Top ]

socketRead   [line 208]

void socketRead( )

Read from $this->_socket() via fgets(). Abstracted for testing.
  • Access: protected

[ Top ]

socketWrite   [line 197]

mixed socketWrite( string $command)

Write a command to the socket. Abstracted for testing.
  • Return: return of fwrite()
  • Access: protected

Parameters:

string   $command   —  Command, which should include a trailing \n

[ Top ]

storeData   [line 616]

void storeData( string $key, string $class, string $data)

Write a variable to Mogile.
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $key   —  The mogile key of the new file.
string   $class   —  The mogile class of the new file.
string   $data   —  The data to be stored.

[ Top ]

storeFile   [line 601]

void storeFile( string $key, string $class, string $filename)

Write a file to Mogile.
  • Throws: File_Mogile_Exception
  • Access: public

Parameters:

string   $key   —  The mogile key of the new file.
string   $class   —  The mogile class of the new file.
string   $filename   —  The native file system path of the file to be stored.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:36:05 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.