MediaWiki REL1_39
MediaWiki\Storage\BlobStore Interface Reference

Service for loading and storing data blobs. More...

Inheritance diagram for MediaWiki\Storage\BlobStore:

Public Member Functions

 getBlob ( $blobAddress, $queryFlags=0)
 Retrieve a blob, given an address.
 
 getBlobBatch ( $blobAddresses, $queryFlags=0)
 A batched version of BlobStore::getBlob.
 
 isReadOnly ()
 Check if the blob metadata or backing blob data store is read-only.
 
 storeBlob ( $data, $hints=[])
 Stores an arbitrary blob of data and returns an address that can be used with getBlob() to retrieve the same blob of data,.
 

Public Attributes

const DESIGNATION_HINT = 'designation'
 Hint key for use with storeBlob, indicating the general role the block takes in the application.
 
const FORMAT_HINT = 'cont_format'
 Hint key for use with storeBlob, indicating the serialization format used to create the blob, as a MIME type.
 
const IMAGE_HINT = 'img_name'
 Hint key for an image name.
 
const MODEL_HINT = 'cont_model'
 Hint key for use with storeBlob, indicating the model of the content encoded in the given blob.
 
const PAGE_HINT = 'page_id'
 Hint key for use with storeBlob, indicating the page the blob is associated with.
 
const PARENT_HINT = 'rev_parent_id'
 Hint key for use with storeBlob, indicating the parent revision of the revision the blob is associated with.
 
const REVISION_HINT = 'rev_id'
 Hint key for use with storeBlob, indicating the revision the blob is associated with.
 
const ROLE_HINT = 'role_name'
 Hint key for use with storeBlob, indicating the slot the blob is associated with.
 
const SHA1_HINT = 'cont_sha1'
 Hint key for use with storeBlob, providing the SHA1 hash of the blob as passed to the method.
 

Detailed Description

Service for loading and storing data blobs.

Note
This was written to act as a drop-in replacement for the corresponding static methods in the old Revision class (which was later removed in 1.37).
Since
1.31

Definition at line 35 of file BlobStore.php.

Member Function Documentation

◆ getBlob()

MediaWiki\Storage\BlobStore::getBlob ( $blobAddress,
$queryFlags = 0 )

Retrieve a blob, given an address.

MCR migration note: this replaced Revision::loadText

Parameters
string$blobAddressThe blob address as returned by storeBlob(), such as "tt:12345" or "ex:DB://s16/456/9876".
int$queryFlagsSee IDBAccessObject.
Exceptions
BlobAccessException
Returns
string binary blob data

Implemented in MediaWiki\Storage\SqlBlobStore.

◆ getBlobBatch()

MediaWiki\Storage\BlobStore::getBlobBatch ( $blobAddresses,
$queryFlags = 0 )

A batched version of BlobStore::getBlob.

Parameters
string[]$blobAddressesAn array of blob addresses.
int$queryFlagsSee IDBAccessObject.
Exceptions
BlobAccessException
Returns
StatusValue A status with a map of blobAddress => binary blob data or null if fetching the blob has failed. Fetch failures errors are the warnings in the status object.
Since
1.34

Implemented in MediaWiki\Storage\SqlBlobStore.

◆ isReadOnly()

MediaWiki\Storage\BlobStore::isReadOnly ( )

Check if the blob metadata or backing blob data store is read-only.

Returns
bool

Implemented in MediaWiki\Storage\SqlBlobStore.

◆ storeBlob()

MediaWiki\Storage\BlobStore::storeBlob ( $data,
$hints = [] )

Stores an arbitrary blob of data and returns an address that can be used with getBlob() to retrieve the same blob of data,.

Parameters
string$dataraw binary data
array$hintsAn array of hints. Implementations may use the hints to optimize storage. All hints are optional, supported hints depend on the implementation. Hint names by convention correspond to the names of fields in the database. Callers are encouraged to provide the well known hints as defined by the XXX_HINT constants.
Exceptions
BlobAccessException
Returns
string an address that can be used with getBlob() to retrieve the data.

Implemented in MediaWiki\Storage\SqlBlobStore.

Member Data Documentation

◆ DESIGNATION_HINT

const MediaWiki\Storage\BlobStore::DESIGNATION_HINT = 'designation'

Hint key for use with storeBlob, indicating the general role the block takes in the application.

For instance, it should be "page-content" if the blob represents a Content object.

Definition at line 42 of file BlobStore.php.

◆ FORMAT_HINT

const MediaWiki\Storage\BlobStore::FORMAT_HINT = 'cont_format'

Hint key for use with storeBlob, indicating the serialization format used to create the blob, as a MIME type.

May be used for optimized storage in the underlying database.

Definition at line 84 of file BlobStore.php.

◆ IMAGE_HINT

const MediaWiki\Storage\BlobStore::IMAGE_HINT = 'img_name'

Hint key for an image name.

Definition at line 89 of file BlobStore.php.

◆ MODEL_HINT

const MediaWiki\Storage\BlobStore::MODEL_HINT = 'cont_model'

Hint key for use with storeBlob, indicating the model of the content encoded in the given blob.

May be used to implement optimized storage for some well known models.

Definition at line 78 of file BlobStore.php.

◆ PAGE_HINT

const MediaWiki\Storage\BlobStore::PAGE_HINT = 'page_id'

Hint key for use with storeBlob, indicating the page the blob is associated with.

This may be used for sharding.

Definition at line 48 of file BlobStore.php.

◆ PARENT_HINT

const MediaWiki\Storage\BlobStore::PARENT_HINT = 'rev_parent_id'

Hint key for use with storeBlob, indicating the parent revision of the revision the blob is associated with.

This may be used for differential storage.

Definition at line 66 of file BlobStore.php.

◆ REVISION_HINT

const MediaWiki\Storage\BlobStore::REVISION_HINT = 'rev_id'

Hint key for use with storeBlob, indicating the revision the blob is associated with.

This may be used for differential storage and reference counting.

Definition at line 60 of file BlobStore.php.

◆ ROLE_HINT

const MediaWiki\Storage\BlobStore::ROLE_HINT = 'role_name'

Hint key for use with storeBlob, indicating the slot the blob is associated with.

May be relevant for reference counting.

Definition at line 54 of file BlobStore.php.

◆ SHA1_HINT

const MediaWiki\Storage\BlobStore::SHA1_HINT = 'cont_sha1'

Hint key for use with storeBlob, providing the SHA1 hash of the blob as passed to the method.

This can be used to avoid re-calculating the hash if it is needed by the BlobStore.

Definition at line 72 of file BlobStore.php.


The documentation for this interface was generated from the following file: