Package io.bdeploy.bhive.meta
Class MetaManifest<T>
java.lang.Object
io.bdeploy.bhive.meta.MetaManifest<T>
A
MetaManifest allows to persist an load metadata associated with a given Manifest.
It is possible to put multiple metadata infos on a single Manifest, distinguished by the Class
simple name. Each metadata object is stored in a separate blob to allow cheap reading of
individual data streams without the need to touch/read any other metadata object.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMetaManifest(Manifest.Key parent, boolean useParentTag, Class<T> metaClazz) Create aMetaManifestfor the givenManifest.Keywhich identifies theManifestto "annotate" with metadata. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisMetaManifest(Manifest.Key meta) static booleanisParentAlive(Manifest.Key meta, BHiveExecution hive, SortedSet<Manifest.Key> ignore) read(BHiveExecution source) Read the current metadata from the givenBHiveExecution.remove(BHiveExecution target) Removes the metadata from the givenBHiveExecution.write(BHiveExecution target, T meta) Writes the given metadata object to the givenBHiveExecution.
-
Field Details
-
META_PREFIX
- See Also:
-
META_HIST_SIZE
public static final int META_HIST_SIZE- See Also:
-
-
Constructor Details
-
MetaManifest
Create aMetaManifestfor the givenManifest.Keywhich identifies theManifestto "annotate" with metadata.- Parameters:
parent- the parentManifestsManifest.Key.useParentTag- whether the metadata is tag specific or valid for any tag of the givenManifest. Attention: reading and writing must happen with the same parameter. Tag specific metadata is not read by a non-tag specificMetaManifestand vice versa.metaClazz- theClassof the metadata to store. ThisClassmust be serializable by theStorageHelper.
-
-
Method Details
-
isMetaManifest
-
isParentAlive
public static boolean isParentAlive(Manifest.Key meta, BHiveExecution hive, SortedSet<Manifest.Key> ignore) -
read
Read the current metadata from the givenBHiveExecution.- Parameters:
source- the sourceBHiveExecution- Returns:
- The current version of the metadata.
nullif no metadata for the givenClassis present.
-
write
Writes the given metadata object to the givenBHiveExecution.- Parameters:
target- the targetBHiveExecutionmeta- the metadata object.nullwill cause the entry to be deleted, so subsequentread(io.bdeploy.bhive.BHiveExecution)calls will returnnullas well.- Returns:
- the
Manifest.Keyof the current metadata manifest.
-
remove
Removes the metadata from the givenBHiveExecution. Convenience shortcut forwrite(target, null).- Parameters:
target- the target to delete from.- Returns:
- the
Manifest.Keyof the current metadata manifest.
-
getMetaName
-