[line 49]
Representation of data inside the image database.
This class tries to hide the fact that image data stored inside the database are fragmented into pieces of (default) 512 kB. It handles inserting, fetching, caching and deleting of the data. This class doesn't handle information specific to images, like resolution. It is therefor suitable for other data like audio or video. A note to referenceCount: It is introduced to delete blobs which aren't referenced anymore. Maybe this should be resolved somehow with foreign keys - can anyone tell me how? A safe solution would be to count the referencing items every time the blob might become orphaned by deleting a referencing item, but this is an impact on performance. In this solution, you can use reference() and dereference() to automatically delete a blob that isn't referenced anymore.
Remove unwanted characters and convert to lowercase.
This method removes all characters which aren't alphanumeric, '-' or '_' from the given string. Then it's made lowercase. It is used in GALBlob::createFromFile().
Insert a new blob and read data from the specified file.
To speed up things, this method provides a way to adjust how the data get into the local disk cache to make it possible to move the data within a filesystem to their new location if the source file isn't needed anymore.
Tags:
return:
The newly created blob.
Parameters:
string
$path
Source path of data.
string
$mime
MIME type of the data.
string
$extension
The file extension of the blob. It is not determined from the source file's name.
This method deletes all data associated with this blob. Note that the cached data are only deleted if they are stored on the cluster node where this function is called, so from time to time one needs to scan the cache on every node for orphan cache entries. No reason to worry - they do nothing harmful except of using disk space. Because blobID is increased strictly monotonally for new blobs, a new blob will never interfere with old data. But take care: After creating (2^32) - 1 blobs, a wrap-around could happen... ;)
Decrease the reference count of this blob and delete it if necessary.
Use this method if you delete a referencing item. If the reference count reaches 0, the blob is deleted. This method is called automatically in GALJob::delete() and GALInstance::delete()
no need for you to do this unless you know exactly what you're doing!
Path to the data of this blob in the local disk cache.
If this blob isn't cached locally, the data are downloaded from the database to the cache. Note that changing the cached data leads to undefined behavior. If you want to change image data, please create a new blob and change all references so they point to the new blob.
When creating a new GALBlob from a file, don't try to copy it to the local disk cache. This might be useful if one tries to insert data from another user account than the disk cache owner.
When creating a new GALBlob from a file, the source file is read with stream functions and copied to the local disk cache. This is useful if the source file is not in the local filesystem, but this isn't supported yet.