Package org.apache.solr.rest
Class ManagedResourceStorage
java.lang.Object
org.apache.solr.rest.ManagedResourceStorage
- Direct Known Subclasses:
ManagedResourceStorage.JsonStorage
Abstract base class that provides most of the functionality needed to store arbitrary data for
managed resources. Concrete implementations need to decide the underlying format that data is
stored in, such as JSON.
The underlying storage I/O layer will be determined by the environment Solr is running in, e.g. in cloud mode, data will be stored and loaded from ZooKeeper.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLocal file-based storage implementation.static classMemory-backed storage IO; not really intended for storage large amounts of data in production, but useful for testing and other transient workloads.static classDefault storage implementation that uses JSON as the storage format for managed data.static interfaceHides the underlying storage implementation for data being managed by a ManagedResource.static classZooKeeper based storage implementation that uses the SolrZkClient provided by the CoreContainer. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SolrResourceLoaderstatic final Stringstatic final Stringprotected ManagedResourceStorage.StorageIOstatic final Charset -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedManagedResourceStorage(ManagedResourceStorage.StorageIO storageIO, SolrResourceLoader loader) -
Method Summary
Modifier and TypeMethodDescriptionbooleanRemoves the given resourceId's persisted representation.Returns the resource loader used by this storage instanceReturns the storageIO instance used by this storage instanceabstract StringgetStoredResourceId(String resourceId) Gets the unique identifier for a stored resource, typically based on the resourceId and some storage-specific information, such as file extension and storage root directory.Loads a resource from storage; the default implementation makes the assumption that the data is stored as UTF-8 encoded text, such as JSON.newStorageIO(String collection, SolrResourceLoader resourceLoader, org.apache.solr.common.util.NamedList<String> initArgs) Creates a new StorageIO instance for a Solr core, taking into account whether the core is running in cloud mode as well as initArgs.protected ObjectCalled byload(String)to convert the serialized resource into its in-memory representation.abstract voidPersists the given toStore object with the given resourceId.
-
Field Details
-
STORAGE_IO_CLASS_INIT_ARG
- See Also:
-
STORAGE_DIR_INIT_ARG
- See Also:
-
UTF_8
-
storageIO
-
loader
-
-
Constructor Details
-
ManagedResourceStorage
protected ManagedResourceStorage(ManagedResourceStorage.StorageIO storageIO, SolrResourceLoader loader)
-
-
Method Details
-
newStorageIO
public static ManagedResourceStorage.StorageIO newStorageIO(String collection, SolrResourceLoader resourceLoader, org.apache.solr.common.util.NamedList<String> initArgs) Creates a new StorageIO instance for a Solr core, taking into account whether the core is running in cloud mode as well as initArgs. -
getResourceLoader
Returns the resource loader used by this storage instance -
getStorageIO
Returns the storageIO instance used by this storage instance -
getStoredResourceId
Gets the unique identifier for a stored resource, typically based on the resourceId and some storage-specific information, such as file extension and storage root directory. -
load
Loads a resource from storage; the default implementation makes the assumption that the data is stored as UTF-8 encoded text, such as JSON. This method should be overridden if that assumption is invalid.- Throws:
IOException
-
parseText
Called byload(String)to convert the serialized resource into its in-memory representation.- Throws:
IOException
-
store
Persists the given toStore object with the given resourceId.- Throws:
IOException
-
delete
Removes the given resourceId's persisted representation.- Throws:
IOException
-