public class MetadataDataset
extends co.cask.cdap.api.dataset.lib.AbstractDataset
IndexedTable.| Modifier and Type | Field and Description |
|---|---|
static String |
CASE_INSENSITIVE_VALUE_COLUMN |
static String |
INDEX_COLUMN |
static String |
KEYVALUE_COLUMN |
static String |
KEYVALUE_SEPARATOR |
static String |
TAGS_KEY |
| Constructor and Description |
|---|
MetadataDataset(co.cask.cdap.api.dataset.lib.IndexedTable indexedTable) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTags(Id.NamespacedId targetId,
String... tagsToAdd)
Adds a new tag for the specified
Id.NamespacedId. |
Map<String,String> |
getProperties(Id.NamespacedId targetId)
Retrieves all the properties for the specified
Id.NamespacedId. |
MetadataEntry |
getProperty(Id.NamespacedId targetId,
String key)
Retrieve the
MetadataEntry corresponding to the specified key for the Id.NamespacedId. |
Set<Metadata> |
getSnapshotBeforeTime(Set<Id.NamespacedId> targetIds,
long timeMillis)
Returns the snapshot of the metadata for entities on or before the given time.
|
Set<String> |
getTags(Id.NamespacedId targetId)
Retrieves all the tags for the specified
Id.NamespacedId. |
void |
removeProperties(Id.NamespacedId targetId)
Removes all properties from the specified entity.
|
void |
removeProperties(Id.NamespacedId targetId,
String... keys)
Removes the specified keys from the metadata properties of an entity.
|
void |
removeTags(Id.NamespacedId targetId)
Removes all tags from the specified entity.
|
void |
removeTags(Id.NamespacedId targetId,
String... tagsToRemove)
Removes the specified tags from the specified entity.
|
List<MetadataEntry> |
search(String namespaceId,
String searchQuery,
MetadataSearchTargetType type)
Searches entities that match the specified search query in the specified namespace and
Id.Namespace#SYSTEM
for the specified MetadataSearchTargetType. |
void |
setProperty(Id.NamespacedId targetId,
String key,
String value)
Sets a metadata property for the specified
Id.NamespacedId. |
void |
setProperty(Id.NamespacedId targetId,
String key,
String value,
Indexer indexer)
Sets a metadata property for the specified
Id.NamespacedId. |
void |
upgrade()
Upgrades the metadata from 3.2 to 3.3 for new storage format
|
public static final String INDEX_COLUMN
public static final String CASE_INSENSITIVE_VALUE_COLUMN
public static final String KEYVALUE_COLUMN
public static final String TAGS_KEY
public static final String KEYVALUE_SEPARATOR
public MetadataDataset(co.cask.cdap.api.dataset.lib.IndexedTable indexedTable)
public void setProperty(Id.NamespacedId targetId, String key, String value)
Id.NamespacedId.targetId - The target Id: Id.Application / Id.Program /
Id.DatasetInstance/Id.Streamkey - The metadata key to be addedvalue - The metadata value to be addedpublic void setProperty(Id.NamespacedId targetId, String key, String value, @Nullable Indexer indexer)
Id.NamespacedId.targetId - The target Id: Id.Application / Id.Program /
Id.DatasetInstance/Id.Streamkey - The metadata key to be addedvalue - The metadata value to be addedindexer - the indexer to use to create indexes for this key-value propertypublic void addTags(Id.NamespacedId targetId, String... tagsToAdd)
Id.NamespacedId.targetId - the target Id: app-id(ns+app) / program-id(ns+app+pgtype+pgm) /
dataset-id(ns+dataset)/stream-id(ns+stream).tagsToAdd - the tags to add@Nullable public MetadataEntry getProperty(Id.NamespacedId targetId, String key)
MetadataEntry corresponding to the specified key for the Id.NamespacedId.targetId - the Id.NamespacedId for which the MetadataEntry is to be retrievedkey - the property key for which the MetadataEntry is to be retrievedMetadataEntry corresponding to the specified key for the Id.NamespacedIdpublic Map<String,String> getProperties(Id.NamespacedId targetId)
Id.NamespacedId.targetId - the Id.NamespacedId for which properties are to be retrievedId.NamespacedIdpublic Set<String> getTags(Id.NamespacedId targetId)
Id.NamespacedId.targetId - the Id.NamespacedId for which tags are to be retrievedId.NamespacedIdpublic void removeProperties(Id.NamespacedId targetId, String... keys)
targetId - the Id.NamespacedId from which to remove the specified keyskeys - the keys to removepublic void removeTags(Id.NamespacedId targetId, String... tagsToRemove)
targetId - the Id.NamespacedId from which to remove the specified tagstagsToRemove - the tags to removepublic void removeProperties(Id.NamespacedId targetId)
targetId - the Id.NamespacedId for which to remove the propertiespublic void removeTags(Id.NamespacedId targetId)
targetId - the Id.NamespacedId for which to remove the tagspublic Set<Metadata> getSnapshotBeforeTime(Set<Id.NamespacedId> targetIds, long timeMillis)
targetIds - entity idstimeMillis - time in millisecondspublic List<MetadataEntry> search(String namespaceId, String searchQuery, MetadataSearchTargetType type)
Id.Namespace#SYSTEM
for the specified MetadataSearchTargetType.namespaceId - the namespace to search insearchQuery - the search query, which could be of two forms: [key]:[value] or just [value] and can have '*'
at the end for a prefix searchtype - the MetadataSearchTargetType to restrict the search to.public void upgrade()
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.