public class Storage
extends java.lang.Object
Tasks.| Constructor and Description |
|---|
Storage() |
| Modifier and Type | Method and Description |
|---|---|
static void |
await() |
static java.util.List<java.lang.Long> |
list(CtxCore ctx,
java.lang.String prefix)
Retrieves ids of all files stored for a specific prefix (
Storable.storagePrefix(). |
static java.util.List<java.lang.Long> |
list(CtxCore ctx,
java.lang.String prefix,
int slice)
Retrieves ids of files stored for a specific prefix (
Storable.storagePrefix(). |
static java.util.concurrent.Future<java.util.List<java.lang.Long>> |
listAsync(CtxCore ctx,
java.lang.String prefix,
int slice)
Retrieves ids of files stored for a specific prefix (
Storable.storagePrefix(). |
static java.lang.String |
name(Storable storable) |
static <T extends Storable> |
pop(CtxCore ctx,
T storable)
Reinitializes storable with data stored previously in device internal memory and deletes corresponding file.
|
static <T extends Storable> |
popAsync(CtxCore ctx,
T storable)
Reinitializes storable with data stored previously in device internal memory.
|
static boolean |
push(CtxCore ctx,
Storable storable)
Stores data in device internal memory.
|
static java.util.concurrent.Future<java.lang.Boolean> |
pushAsync(CtxCore ctx,
Storable storable)
Shorthand for
pushAsync(CtxCore, Storable, Tasks.Callback) |
static java.util.concurrent.Future<java.lang.Boolean> |
pushAsync(CtxCore ctx,
Storable storable,
Tasks.Callback<java.lang.Boolean> callback)
Stores data in device internal memory.
|
static <T extends Storable> |
read(CtxCore ctx,
T storable)
Reinitializes storable with data stored previously in device internal memory.
|
static <T extends Storable> |
readAsync(CtxCore ctx,
T storable)
Reinitializes storable with data stored previously in device internal memory.
|
static <T extends Storable> |
readAsync(CtxCore ctx,
T storable,
Tasks.Callback<T> callback)
Reinitializes storable with data stored previously in device internal memory.
|
static <T extends Storable> |
readOne(CtxCore ctx,
T storable,
boolean asc)
Reinitializes first (or last if asc is false) storable with prefix from storable supplied as parameter.
|
static <T extends Storable> |
readOneAsync(CtxCore ctx,
T storable,
boolean asc)
Reinitializes first (or last if asc is false) storable with prefix from storable supplied as parameter.
|
static <T extends Storable> |
remove(CtxCore ctx,
T storable)
Removes storable from storage.
|
static <T extends Storable> |
removeAsync(CtxCore ctx,
T storable,
Tasks.Callback<java.lang.Boolean> callback)
Removes storable from storage.
|
static void |
stop() |
public static java.lang.String name(Storable storable)
public static boolean push(CtxCore ctx, Storable storable)
ctx - context to run instorable - Object to storepublic static java.util.concurrent.Future<java.lang.Boolean> pushAsync(CtxCore ctx, Storable storable, Tasks.Callback<java.lang.Boolean> callback)
Tasksctx - context to run instorable - Object to storecallback - nullable callback to call when donepublic static java.util.concurrent.Future<java.lang.Boolean> pushAsync(CtxCore ctx, Storable storable)
pushAsync(CtxCore, Storable, Tasks.Callback)ctx - context to run instorable - Object to storepublic static <T extends Storable> java.lang.Boolean remove(CtxCore ctx, T storable)
ctx - context to run instorable - Object to removepublic static <T extends Storable> java.util.concurrent.Future<java.lang.Boolean> removeAsync(CtxCore ctx, T storable, Tasks.Callback<java.lang.Boolean> callback)
Tasksctx - context to run instorable - Object to removepublic static <T extends Storable> T pop(CtxCore ctx, T storable)
ctx - context to run instorable - Object to reinitializepublic static <T extends Storable> java.util.concurrent.Future<T> popAsync(CtxCore ctx, T storable)
Tasksctx - context to run instorable - Object to reinitializepublic static <T extends Storable> T read(CtxCore ctx, T storable)
ctx - context to run instorable - Object to reinitializepublic static <T extends Storable> java.util.concurrent.Future<T> readAsync(CtxCore ctx, T storable)
Tasksctx - context to run instorable - Object to reinitializepublic static <T extends Storable> java.util.concurrent.Future<T> readAsync(CtxCore ctx, T storable, Tasks.Callback<T> callback)
Tasksctx - context to run instorable - Object to reinitializecallback - Callback to call with read resultpublic static <T extends Storable> T readOne(CtxCore ctx, T storable, boolean asc)
ctx - context to run instorable - Object to get prefix fromasc - true if reading first storable, false if reading last onepublic static <T extends Storable> java.util.concurrent.Future<T> readOneAsync(CtxCore ctx, T storable, boolean asc)
Tasksctx - Ctx to run instorable - Object to get prefix fromasc - true if reading first storable, false if reading last onepublic static java.util.List<java.lang.Long> list(CtxCore ctx, java.lang.String prefix)
Storable.storagePrefix().
Runs in a storage thread provided by Tasks, current thread waits for read completion.prefix - String representing type of storable to list (prefix of file names)public static java.util.List<java.lang.Long> list(CtxCore ctx, java.lang.String prefix, int slice)
Storable.storagePrefix().
Runs in a storage thread provided by Tasks, current thread waits for read completion.prefix - String representing type of storable to list (prefix of file names)slice - integer controlling number and slice direction of results returned:
0 to return all records
1..N to return first N records ordered from first to last
-1..-N to return last N records ordered from last to firstpublic static java.util.concurrent.Future<java.util.List<java.lang.Long>> listAsync(CtxCore ctx, java.lang.String prefix, int slice)
Storable.storagePrefix().
Runs in a storage thread provided by Tasksprefix - String representing type of storable to list (prefix of file names)slice - integer controlling number and slice direction of results returned:
0 to return all records
1..N to return first N records ordered from first to last
-1..-N to return last N records ordered from last to firstpublic static void await()
public static void stop()