Class FileDataStore
- java.lang.Object
-
- ca.stellardrift.permissionsex.impl.backend.AbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
- ca.stellardrift.permissionsex.impl.backend.file.FileDataStore
-
- All Implemented Interfaces:
ca.stellardrift.permissionsex.datastore.DataStore
public final class FileDataStore extends AbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileDataStore.Factory
-
Field Summary
-
Fields inherited from class ca.stellardrift.permissionsex.impl.backend.AbstractDataStore
contextInheritanceListeners, listeners, rankLadderListeners
-
-
Constructor Summary
Constructors Constructor Description FileDataStore(ca.stellardrift.permissionsex.datastore.DataStoreContext context, ca.stellardrift.permissionsex.datastore.ProtoDataStore<ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config> properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Stream<Map.Entry<ca.stellardrift.permissionsex.subject.SubjectRef<?>,ca.stellardrift.permissionsex.subject.ImmutableSubjectData>>getAll()Stream<String>getAllIdentifiers(String type)Stream<String>getAllRankLadders()CompletableFuture<ca.stellardrift.permissionsex.context.ContextInheritance>getContextInheritanceInternal()CompletableFuture<ca.stellardrift.permissionsex.subject.ImmutableSubjectData>getDataInternal(String type, String identifier)CompletableFuture<Set<String>>getDefinedContextKeys()CompletableFuture<ca.stellardrift.permissionsex.rank.RankLadder>getRankLadderInternal(String ladder)Set<String>getRegisteredTypes()CompletableFuture<Boolean>hasRankLadder(String ladder)CompletableFuture<Boolean>isRegistered(String type, String identifier)protected voidload()Load any data necessary to initialize this data store.protected <T> TperformBulkOperationSync(Function<ca.stellardrift.permissionsex.datastore.DataStore,T> function)Internally perform a bulk operation.CompletableFuture<ca.stellardrift.permissionsex.context.ContextInheritance>setContextInheritanceInternal(ca.stellardrift.permissionsex.context.ContextInheritance inheritance)protected CompletableFuture<ca.stellardrift.permissionsex.subject.ImmutableSubjectData>setDataInternal(String type, String identifier, @Nullable ca.stellardrift.permissionsex.subject.ImmutableSubjectData data)CompletableFuture<ca.stellardrift.permissionsex.rank.RankLadder>setRankLadderInternal(String identifier, @Nullable ca.stellardrift.permissionsex.rank.RankLadder ladder)-
Methods inherited from class ca.stellardrift.permissionsex.impl.backend.AbstractDataStore
applyDefaultData, config, context, engine, firstRun, getAll, getContextInheritance, getData, getRankLadder, markFirstRun, moveData, name, performBulkOperation, runAsync, runAsync, setContextInheritance, setData, setRankLadder
-
-
-
-
Constructor Detail
-
FileDataStore
public FileDataStore(ca.stellardrift.permissionsex.datastore.DataStoreContext context, ca.stellardrift.permissionsex.datastore.ProtoDataStore<ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config> properties)
-
-
Method Detail
-
load
protected void load() throws ca.stellardrift.permissionsex.exception.PermissionsLoadingException
Description copied from class:AbstractDataStoreLoad any data necessary to initialize this data store.- Specified by:
loadin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>- Throws:
ca.stellardrift.permissionsex.exception.PermissionsLoadingException- if unable to load
-
close
public void close()
-
getDataInternal
public CompletableFuture<ca.stellardrift.permissionsex.subject.ImmutableSubjectData> getDataInternal(String type, String identifier)
- Specified by:
getDataInternalin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
setDataInternal
protected CompletableFuture<ca.stellardrift.permissionsex.subject.ImmutableSubjectData> setDataInternal(String type, String identifier, @Nullable ca.stellardrift.permissionsex.subject.ImmutableSubjectData data)
- Specified by:
setDataInternalin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
isRegistered
public CompletableFuture<Boolean> isRegistered(String type, String identifier)
-
getAllIdentifiers
public Stream<String> getAllIdentifiers(String type)
-
getRegisteredTypes
public Set<String> getRegisteredTypes()
-
getDefinedContextKeys
public CompletableFuture<Set<String>> getDefinedContextKeys()
-
getAll
public Stream<Map.Entry<ca.stellardrift.permissionsex.subject.SubjectRef<?>,ca.stellardrift.permissionsex.subject.ImmutableSubjectData>> getAll()
-
getAllRankLadders
public Stream<String> getAllRankLadders()
-
getRankLadderInternal
public CompletableFuture<ca.stellardrift.permissionsex.rank.RankLadder> getRankLadderInternal(String ladder)
- Specified by:
getRankLadderInternalin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
hasRankLadder
public CompletableFuture<Boolean> hasRankLadder(String ladder)
-
getContextInheritanceInternal
public CompletableFuture<ca.stellardrift.permissionsex.context.ContextInheritance> getContextInheritanceInternal()
- Specified by:
getContextInheritanceInternalin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
setContextInheritanceInternal
public CompletableFuture<ca.stellardrift.permissionsex.context.ContextInheritance> setContextInheritanceInternal(ca.stellardrift.permissionsex.context.ContextInheritance inheritance)
- Specified by:
setContextInheritanceInternalin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
setRankLadderInternal
public CompletableFuture<ca.stellardrift.permissionsex.rank.RankLadder> setRankLadderInternal(String identifier, @Nullable ca.stellardrift.permissionsex.rank.RankLadder ladder)
- Specified by:
setRankLadderInternalin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>
-
performBulkOperationSync
protected <T> T performBulkOperationSync(Function<ca.stellardrift.permissionsex.datastore.DataStore,T> function) throws Exception
Description copied from class:AbstractDataStoreInternally perform a bulk operation.Safe to call blocking operations from this method -- we're running it asyncly.
- Specified by:
performBulkOperationSyncin classAbstractDataStore<FileDataStore,ca.stellardrift.permissionsex.impl.backend.file.FileDataStore.Config>- Type Parameters:
T- The- Parameters:
function- The function to run- Returns:
- result of operation, after a save
- Throws:
Exception- if thrown by operation
-
-