public class FileBasedObjectStore extends java.lang.Object implements PersistenceObjectStore
PersistenceObjectStore.StoreObjectAccessor, PersistenceObjectStore.StoreObjectAccessorWithLock
Constructor and Description |
---|
FileBasedObjectStore(java.io.File basedir) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all resources used by this ObjectStore.
|
void |
createSubPath(java.lang.String subPath)
create the directory at the given subPath relative to the base of this store
|
void |
deleteCompletely()
Entirely delete the contents of this persistence location.
|
static void |
deleteCompletely(java.io.File d) |
java.io.File |
getBaseDir() |
java.lang.String |
getSummaryName()
human-readable name of this object store
|
void |
injectManagementContext(ManagementContext mgmt)
Allows a way for an object store to be created ahead of time, and a mgmt context injected.
|
java.util.List<java.lang.String> |
listContentsWithSubPath(java.lang.String parentSubPath)
Lists the paths of objects contained at the given path, including the subpath.
|
PersistenceObjectStore.StoreObjectAccessor |
newAccessor(java.lang.String path)
For reading/writing data to the item at the given path.
|
void |
prepareForMasterUse()
Prepares the persistence store for "contentious writes".
|
void |
prepareForSharedUse(PersistMode persistMode,
HighAvailabilityMode haMode)
Prepares the persistence store for read use and non-contentious write use,
in particular detecting whether we should clean or register a need for backup etc.
|
java.lang.String |
toString() |
public FileBasedObjectStore(java.io.File basedir)
basedir
- public java.lang.String getSummaryName()
PersistenceObjectStore
getSummaryName
in interface PersistenceObjectStore
public java.io.File getBaseDir()
public void prepareForMasterUse()
PersistenceObjectStore
Caller must call PersistenceObjectStore.prepareForSharedUse(PersistMode, HighAvailabilityMode)
first
(and PersistenceObjectStore.injectManagementContext(ManagementContext)
before that).
This is typically invoked "at the last moment" e.g. before the any such write, mainly in order to prevent backups being made unnecessarily (e.g. if a node is standby, or if it tries to become master but is not capable), but also to prevent simultaneous backups which can cause problems with some stores (only a mgmt who knows he is the master should invoke this).
prepareForMasterUse
in interface PersistenceObjectStore
public void createSubPath(java.lang.String subPath)
PersistenceObjectStore
createSubPath
in interface PersistenceObjectStore
public PersistenceObjectStore.StoreObjectAccessor newAccessor(java.lang.String path)
PersistenceObjectStore
Clients should wrap in a dedicated StoreObjectAccessorLocking
and share
if multiple threads may be accessing the store.
This method may be changed in future to allow access to a shared locking accessor.
newAccessor
in interface PersistenceObjectStore
public java.util.List<java.lang.String> listContentsWithSubPath(java.lang.String parentSubPath)
PersistenceObjectStore
PersistenceObjectStore.newAccessor(String)
.listContentsWithSubPath
in interface PersistenceObjectStore
public void close()
PersistenceObjectStore
close
in interface PersistenceObjectStore
public java.lang.String toString()
toString
in class java.lang.Object
public void injectManagementContext(ManagementContext mgmt)
PersistenceObjectStore
A ManagementContext
must be supplied via constructor or this method before invoking other methods.
injectManagementContext
in interface PersistenceObjectStore
public void prepareForSharedUse(@Nullable PersistMode persistMode, HighAvailabilityMode haMode)
PersistenceObjectStore
PersistenceObjectStore.injectManagementContext(ManagementContext)
,
but before PersistenceObjectStore.prepareForMasterUse()
.
See PersistenceObjectStore.prepareForMasterUse()
for discussion of "contentious writes".
prepareForSharedUse
in interface PersistenceObjectStore
public void deleteCompletely()
PersistenceObjectStore
deleteCompletely
in interface PersistenceObjectStore
public static void deleteCompletely(java.io.File d)