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

Method call

src/tools/MetaSync.java:229–347  ·  view source on GitHub ↗
(final TSMeta meta)

Source from the content-addressed store, hash-verified

227 }
228
229 @Override
230 public Deferred<Boolean> call(final TSMeta meta) throws Exception {
231
232 /** Called to process the new meta through the search plugin and tree code */
233 final class IndexCB implements Callback<Deferred<Boolean>, TSMeta> {
234 @Override
235 public Deferred<Boolean> call(final TSMeta new_meta) throws Exception {
236 tsdb.indexTSMeta(new_meta);
237 // pass through the trees
238 return tsdb.processTSMetaThroughTrees(new_meta);
239 }
240 }
241
242 /** Called to load the newly created meta object for passage onto the
243 * search plugin and tree builder if configured
244 */
245 final class GetCB implements Callback<Deferred<Boolean>, Boolean> {
246 @Override
247 public final Deferred<Boolean> call(final Boolean exists)
248 throws Exception {
249 if (exists) {
250 return TSMeta.getTSMeta(tsdb, tsuid_string)
251 .addCallbackDeferring(new IndexCB());
252 } else {
253 return Deferred.fromResult(false);
254 }
255 }
256 }
257
258 /** Errback on the store new call to catch issues */
259 class ErrBack implements Callback<Object, Exception> {
260 public Object call(final Exception e) throws Exception {
261 LOG.warn("Failed creating meta for: " + tsuid +
262 " with exception: ", e);
263 return null;
264 }
265 }
266
267 // if we couldn't find a TSMeta in storage, then we need to generate a
268 // new one
269 if (meta == null) {
270
271 /**
272 * Called after successfully creating a TSMeta counter and object,
273 * used to convert the deferred long to a boolean so it can be
274 * combined with other calls for waiting.
275 */
276 final class CreatedCB implements Callback<Deferred<Boolean>, Long> {
277
278 @Override
279 public Deferred<Boolean> call(Long value) throws Exception {
280 LOG.info("Created counter and meta for timeseries [" +
281 tsuid_string + "]");
282 return Deferred.fromResult(true);
283 }
284
285 }
286

Callers

nothing calls this directly

Calls 8

storeNewMethod · 0.95
isEmptyMethod · 0.80
getTSUIDMethod · 0.45
indexTSMetaMethod · 0.45
getCreatedMethod · 0.45
setCreatedMethod · 0.45
syncToStorageMethod · 0.45

Tested by

no test coverage detected