docs: public static Deferred<Long> incrementAndGetCounter(final TSDB tsdb, 
        final byte[] tsuid) {
      
      /**
       * Callback that will create a new TSMeta if the increment result is 1 or
       * will simply return the new value.
       */
      final class TSMetaCB implements Callback<Deferred<Long>, Long> {
  
        /**
         * Called after incrementing the counter and will create a new TSMeta if
         * the returned value was 1 as well as pass the new meta through trees
         * and the search indexer if configured.
         * @return 0 if the put failed, a positive LONG if the put was successful
         */
        @Override
        public Deferred<Long> call(final Long incremented_value) 
          throws Exception {
          LOG.debug("Value: " + incremented_value);
          if (incremented_value > 1) {
            // TODO - maybe update the search index every X number of increments?
            // Otherwise the search engine would only get last_updated/count 
            // whenever the user runs the full sync CLI
            return Deferred.fromResult(incremented_value);
          }
          
          // create a new meta object with the current system timestamp. Ideally
          // we would want the data point's timestamp, but that's much more data
          // to keep track of and may not be accurate.
          final TSMeta meta = new TSMeta(tsuid, 
              System.currentTimeMillis() / 1000);
          
          /**
           * Called after the meta has been passed through tree processing. The 
           * result of the processing doesn't matter and the user may not even
           * have it enabled, so we'll just return the counter.
           */
          final class TreeCB implements Callback<Deferred<Long>, Boolean> {
  
            @Override
            public Deferred<Long> call(Boolean success) throws Exception {
              return Deferred.fromResult(incremented_value);
            }
            
          }
          
          /**
           * Called after retrieving the newly stored TSMeta and loading
           * associated UIDMeta objects. This class will also pass the meta to the
           * search plugin and run it through any configured trees
           */
          final class FetchNewCB implements Callback<Deferred<Long>, TSMeta> {
  
            @Override
            public Deferred<Long> call(TSMeta stored_meta) throws Exception {
              
              // pass to the search plugin
              tsdb.indexTSMeta(stored_meta);
              
              // pass through the trees
              return tsdb.processTSMetaThroughTrees(stored_meta)
                .addCallbackDeferring(new TreeCB());
            }
            
          }
          
          /**
           * Called after the CAS to store the new TSMeta object. If the CAS
           * failed then we return immediately with a 0 for the counter value.
           * Otherwise we keep processing to load the meta and pass it on.
           */
          final class StoreNewCB implements Callback<Deferred<Long>, Boolean> {
  
            @Override
            public Deferred<Long> call(Boolean success) throws Exception {
              if (!success) {
                LOG.warn("Unable to save metadata: " + meta);
                return Deferred.fromResult(0L);
              }
              
              LOG.info("Successfullly created new TSUID entry for: " + meta);
              return new LoadUIDs(tsdb, UniqueId.uidToString(tsuid)).call(meta)
                      .addCallbackDeferring(new FetchNewCB());
            }
            
          }
          
          // store the new TSMeta object and setup the callback chain
          return meta.storeNew(tsdb).addCallbackDeferring(new StoreNewCB());          
        }
        
      }
  
      // setup the increment request and execute
      final AtomicIncrementRequest inc = new AtomicIncrementRequest(
          tsdb.metaTable(), tsuid, FAMILY, COUNTER_QUALIFIER);
      // if the user has disabled real time TSMeta tracking (due to OOM issues)
      // then we only want to increment the data point count.
      if (!tsdb.getConfig().enable_realtime_ts()) {
        return tsdb.getClient().atomicIncrement(inc);
      }
      return tsdb.getClient().atomicIncrement(inc).addCallbackDeferring(
          new TSMetaCB());
    }