wiki.techinc.nl/includes/edit/ParsoidOutputStash.php
Derick Alangi 13f6ec9e1b Rest: Migrate parsoid stashing logic from RESTbase
Add stash option to /page/html & /revision/html endpoints.
When this option is set, the PageBundle returned by Parsoid is
stashed and an etag is returned that can later be used to
make use of the stashed PageBundle.

The stash is for now backed by the BagOStuff returned by
ObjectCache::getLocalClusterInstance().

This patch adds additional data to the ParserOutput stored in ParserCache.
Old entries lacking that data will be ignored.

Bug: T267990
Co-Authored-by: Nikki <nnikkhoui@wikimedia.org>
Change-Id: Id35f1423a69e3ff63e4f9883b3f7e3f9521d81d5
2022-05-23 17:28:29 +01:00

41 lines
1.1 KiB
PHP

<?php
namespace MediaWiki\Edit;
use MediaWiki\Parser\Parsoid\ParsoidRenderID;
use Wikimedia\Parsoid\Core\PageBundle;
/**
* Interface for saving and retrieval of Parsoid HTML and
* Parsoid metadata from storage.
*
* @since 1.39
*/
interface ParsoidOutputStash {
/**
* Stash a PageBundle representing a rendering of a revision at a given point in time.
*
* The given PageBundle can for some time later be retrieved by calling get( $renderId ).
*
* @param ParsoidRenderID $renderId Combination of revision ID and revision's time ID
* @param PageBundle $bundle
*
* @return bool True on success
*/
public function set( ParsoidRenderID $renderId, PageBundle $bundle ): bool;
/**
* Retrieve a page bundle (that was previously put in the stash using the ->set() method)
* from the stash using a unique render ID.
*
* The page bundle stays in the stash for some time and not guaranteed to be persistent
* across requests.
*
* @param ParsoidRenderID $renderId
*
* @return ?PageBundle
*/
public function get( ParsoidRenderID $renderId ): ?PageBundle;
}