docs: public Deferred<Boolean> syncToStorage(final TSDB tsdb, 
        final boolean overwrite) {
      if (tsuid == null || tsuid.isEmpty()) {
        throw new IllegalArgumentException("Missing TSUID");
      }
      
      boolean has_changes = false;
      for (Map.Entry<String, Boolean> entry : changed.entrySet()) {
        if (entry.getValue()) {
          has_changes = true;
          break;
        }
      }
      if (!has_changes) {
        LOG.debug(this + " does not have changes, skipping sync to storage");
        throw new IllegalStateException("No changes detected in TSUID meta data");
      }
  
      /**
       * Callback used to verify that the UID name mappings exist. We don't need
       * to process the actual name, we just want it to throw an error if any
       * of the UIDs don't exist.
       */
      class UidCB implements Callback<Object, String> {
  
        @Override
        public Object call(String name) throws Exception {
          // nothing to do as missing mappings will throw a NoSuchUniqueId
          return null;
        }
        
      }
      
      // parse out the tags from the tsuid
      final List<byte[]> parsed_tags = UniqueId.getTagsFromTSUID(tsuid);
      
      // Deferred group used to accumulate UidCB callbacks so the next call
      // can wait until all of the UIDs have been verified
      ArrayList<Deferred<Object>> uid_group = 
        new ArrayList<Deferred<Object>>(parsed_tags.size() + 1);
      
      // calculate the metric UID and fetch it's name mapping
      final byte[] metric_uid = UniqueId.stringToUid(
          tsuid.substring(0, TSDB.metrics_width() * 2));
      uid_group.add(tsdb.getUidName(UniqueIdType.METRIC, metric_uid)
          .addCallback(new UidCB()));
      
      int idx = 0;
      for (byte[] tag : parsed_tags) {
        if (idx % 2 == 0) {
          uid_group.add(tsdb.getUidName(UniqueIdType.TAGK, tag)
              .addCallback(new UidCB()));
        } else {
          uid_group.add(tsdb.getUidName(UniqueIdType.TAGV, tag)
              .addCallback(new UidCB()));
        }
        idx++;
      }
      
      /**
       * Callback executed after all of the UID mappings have been verified. This
       * will then proceed with the CAS call.
       */
      final class ValidateCB implements Callback<Deferred<Boolean>, 
        ArrayList<Object>> {
        private final TSMeta local_meta;
        
        public ValidateCB(final TSMeta local_meta) {
          this.local_meta = local_meta;
        }
        
        /**
         * Nested class that executes the CAS after retrieving existing TSMeta
         * from storage.
         */
        final class StoreCB implements Callback<Deferred<Boolean>, TSMeta> {
  
          /**
           * Executes the CAS if the TSMeta was successfully retrieved
           * @return True if the CAS was successful, false if the stored data
           * was modified in flight
           * @throws IllegalArgumentException if the TSMeta did not exist in
           * storage. Only the TSD should be able to create TSMeta objects.
           */
          @Override
          public Deferred<Boolean> call(TSMeta stored_meta) throws Exception {
            if (stored_meta == null) {
              throw new IllegalArgumentException("Requested TSMeta did not exist");
            }
            
            final byte[] original_meta = stored_meta.getStorageJSON();
            local_meta.syncMeta(stored_meta, overwrite);
  
            final PutRequest put = new PutRequest(tsdb.metaTable(), 
                UniqueId.stringToUid(local_meta.tsuid), FAMILY, META_QUALIFIER, 
                local_meta.getStorageJSON());
  
            return tsdb.getClient().compareAndSet(put, original_meta);
          }
          
        }
        
        /**
         * Called on UID mapping verification and continues executing the CAS 
         * procedure.
         * @return Results from the {@link #StoreCB} callback
         */
        @Override
        public Deferred<Boolean> call(ArrayList<Object> validated) 
          throws Exception {
          return getFromStorage(tsdb, UniqueId.stringToUid(tsuid))
            .addCallbackDeferring(new StoreCB());
        }
        
      }
      
      // Begins the callback chain by validating that the UID mappings exist
      return Deferred.group(uid_group).addCallbackDeferring(new ValidateCB(this));
    }