MediaWiki REL1_31
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.
 
 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 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 Revision.
Since
1.31

Definition at line 33 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 replaces 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.

◆ 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 40 of file BlobStore.php.

Referenced by MediaWiki\Storage\RevisionStore\insertRevisionOn().

◆ 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 82 of file BlobStore.php.

Referenced by MediaWiki\Storage\RevisionStore\insertRevisionOn().

◆ 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 76 of file BlobStore.php.

Referenced by MediaWiki\Storage\RevisionStore\insertRevisionOn().

◆ 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 46 of file BlobStore.php.

Referenced by MediaWiki\Storage\RevisionStore\insertRevisionOn().

◆ 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 64 of file BlobStore.php.

Referenced by MediaWiki\Storage\RevisionStore\insertRevisionOn().

◆ 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 58 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 52 of file BlobStore.php.

Referenced by MediaWiki\Storage\RevisionStore\insertRevisionOn().

◆ 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 70 of file BlobStore.php.

Referenced by MediaWiki\Storage\RevisionStore\insertRevisionOn().


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