public class SQLPluginResourceTypeView extends Object implements PluginResourceTypeView
PluginResourceTypeView
. Stores all metadata in a single
database table.Modifier and Type | Method and Description |
---|---|
void |
add(ResourceMeta meta)
Add the resource metadata to the store.
|
void |
delete(String name,
int version)
Delete the given version of the given resource from the store.
|
boolean |
exists(String name)
Checks whether or not any version of the given resource exists.
|
boolean |
exists(String name,
int version)
Checks whether or not a specific version of the given resource exists.
|
ResourceMeta |
get(String name,
int version)
Get the metadata for the given resource name and version.
|
Map<String,Set<ResourceMeta>> |
getAll()
Get an immutable map of resource name to all metadata with that name.
|
Map<String,Set<ResourceMeta>> |
getAll(ResourceStatus status)
Get an immutable map of resource name to all metadata with that name with the given status.
|
Set<ResourceMeta> |
getAll(String name)
Get an immutable set of all resource metadata for the given resource name.
|
Set<ResourceMeta> |
getAll(String name,
ResourceStatus status)
Get an immutable set of all resource metadata for the given resource name with the given status.
|
int |
getHighestVersion(String name)
Get the highest version of given resource, or 0 if the resource does not exist.
|
Set<ResourceMeta> |
getLiveResources()
Get an immutable set of all resources that are currently live.
|
Set<ResourceMeta> |
getResourcesToSync()
Get an immutable set of all resources that are slated to be active after the next sync.
|
void |
recall(String name,
int version)
Recall the given resource, moving a resource in the staged state into the inactive state, or moving a resource
in the active state into the recalled state.
|
void |
stage(String name,
int version)
Atomically stage an inactive resource version and deactivate the current staged version if there is one.
|
public boolean exists(String name) throws IOException
PluginResourceTypeView
exists
in interface PluginResourceTypeView
name
- Name of the resource to check forIOException
public boolean exists(String name, int version) throws IOException
PluginResourceTypeView
exists
in interface PluginResourceTypeView
name
- Name of the resource to check forversion
- Version of the resource to check forIOException
public void add(ResourceMeta meta) throws IOException
PluginResourceTypeView
add
in interface PluginResourceTypeView
meta
- Metadata to addIOException
public int getHighestVersion(String name) throws IOException
PluginResourceTypeView
getHighestVersion
in interface PluginResourceTypeView
name
- Name of the resource to get the highest version ofIOException
public ResourceMeta get(String name, int version) throws IOException
PluginResourceTypeView
get
in interface PluginResourceTypeView
name
- Name of the resource to getversion
- Version of the resource to getIOException
public void delete(String name, int version) throws IOException
PluginResourceTypeView
delete
in interface PluginResourceTypeView
name
- Name of the resource to deleteversion
- Version of the resource to deleteIOException
public Map<String,Set<ResourceMeta>> getAll() throws IOException
PluginResourceTypeView
getAll
in interface PluginResourceTypeView
IOException
public Map<String,Set<ResourceMeta>> getAll(ResourceStatus status) throws IOException
PluginResourceTypeView
getAll
in interface PluginResourceTypeView
status
- Status of the resources to getIOException
public Set<ResourceMeta> getAll(String name) throws IOException
PluginResourceTypeView
getAll
in interface PluginResourceTypeView
name
- Name of resource to get metadata forIOException
public Set<ResourceMeta> getAll(String name, ResourceStatus status) throws IOException
PluginResourceTypeView
getAll
in interface PluginResourceTypeView
name
- Name of resources to getstatus
- Status of the resources to getIOException
public Set<ResourceMeta> getResourcesToSync() throws IOException
PluginResourceTypeView
getResourcesToSync
in interface PluginResourceTypeView
IOException
public Set<ResourceMeta> getLiveResources() throws IOException
PluginResourceTypeView
getLiveResources
in interface PluginResourceTypeView
IOException
public void stage(String name, int version) throws IOException
PluginResourceTypeView
stage
in interface PluginResourceTypeView
name
- Name of resource to stageversion
- Version of resource to stageIOException
public void recall(String name, int version) throws IOException
PluginResourceTypeView
recall
in interface PluginResourceTypeView
name
- Name of resource to recallversion
- Version of resource to recallIOException
Copyright © 2013-2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.