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

Method syncMeta

src/meta/UIDMeta.java:447–478  ·  view source on GitHub ↗

Syncs the local object with the stored object for atomic writes, overwriting the stored data if the user issued a PUT request Note: This method also resets the changed map to false for every field @param meta The stored object to sync from @param overwrite Whether or not all user muta

(final UIDMeta meta, final boolean overwrite)

Source from the content-addressed store, hash-verified

445 * replaced by the local object
446 */
447 private void syncMeta(final UIDMeta meta, final boolean overwrite) {
448 // copy non-user-accessible data first
449 if (meta.uid != null && !meta.uid.isEmpty()) {
450 uid = meta.uid;
451 }
452 if (meta.name != null && !meta.name.isEmpty()) {
453 name = meta.name;
454 }
455 if (meta.type != null) {
456 type = meta.type;
457 }
458 if (meta.created > 0 && (meta.created < created || created == 0)) {
459 created = meta.created;
460 }
461
462 // handle user-accessible stuff
463 if (!overwrite && !changed.get("display_name")) {
464 display_name = meta.display_name;
465 }
466 if (!overwrite && !changed.get("description")) {
467 description = meta.description;
468 }
469 if (!overwrite && !changed.get("notes")) {
470 notes = meta.notes;
471 }
472 if (!overwrite && !changed.get("custom")) {
473 custom = meta.custom;
474 }
475
476 // reset changed flags
477 initializeChangedMap();
478 }
479
480 /**
481 * Sets or resets the changed map flags

Callers 1

callMethod · 0.45

Calls 3

initializeChangedMapMethod · 0.95
isEmptyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected