MCPcopy Create free account
hub / github.com/OpenTSDB/opentsdb / parseFromColumn

Method parseFromColumn

src/meta/TSMeta.java:404–424  ·  view source on GitHub ↗

Parses a TSMeta object from the given column, optionally loading the UIDMeta objects @param tsdb The TSDB to use for storage access @param column The KeyValue column to parse @param load_uidmetas Whether or not UIDmeta objects should be loaded @return A TSMeta if parsed successfully @throws NoSuchUn

(final TSDB tsdb, 
      final KeyValue column, final boolean load_uidmetas)

Source from the content-addressed store, hash-verified

402 * @throws JSONException if the data was corrupted
403 */
404 public static Deferred<TSMeta> parseFromColumn(final TSDB tsdb,
405 final KeyValue column, final boolean load_uidmetas) {
406 if (column.value() == null || column.value().length < 1) {
407 throw new IllegalArgumentException("Empty column value");
408 }
409
410 final TSMeta parsed_meta = JSON.parseToObject(column.value(), TSMeta.class);
411
412 // fix in case the tsuid is missing
413 if (parsed_meta.tsuid == null || parsed_meta.tsuid.isEmpty()) {
414 parsed_meta.tsuid = UniqueId.uidToString(column.key());
415 }
416
417 Deferred<TSMeta> meta = getFromStorage(tsdb, UniqueId.stringToUid(parsed_meta.tsuid));
418
419 if (!load_uidmetas) {
420 return meta;
421 }
422
423 return meta.addCallbackDeferring(new LoadUIDs(tsdb, parsed_meta.tsuid));
424 }
425
426 /**
427 * Determines if an entry exists in storage or not.

Callers 5

parseFromColumnMethod · 0.95
callMethod · 0.95
callMethod · 0.95

Calls 7

parseToObjectMethod · 0.95
uidToStringMethod · 0.95
getFromStorageMethod · 0.95
stringToUidMethod · 0.95
isEmptyMethod · 0.80
keyMethod · 0.65
valueMethod · 0.45

Tested by 3

parseFromColumnMethod · 0.76