MediaWiki  1.32.5
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. More...
 
 isReadOnly ()
 Check if the blob metadata or backing blob data store is read-only. More...
 
 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,. More...
 

Public Attributes

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

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 Revision\RevisionStore\storeContentBlob().

◆ 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 Revision\RevisionStore\storeContentBlob().

◆ 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 Revision\RevisionStore\storeContentBlob().

◆ 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 Revision\RevisionStore\insertRevisionInternal().

◆ 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 Revision\RevisionStore\insertRevisionInternal().

◆ 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.

Referenced by Revision\RevisionStore\insertRevisionInternal().

◆ 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 Revision\RevisionStore\storeContentBlob().

◆ 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 Revision\RevisionStore\storeContentBlob().


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