All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.responsive.kafka.internal.db.TTDWriter Maven / Gradle / Ivy

There is a newer version: 0.37.0
Show newest version
/*
 * Copyright 2024 Responsive Computing, Inc.
 *
 * This source code is licensed under the Responsive Business Source License Agreement v1.0
 * available at:
 *
 * https://www.responsive.dev/legal/responsive-bsl-10
 *
 * This software requires a valid Commercial License Key for production use. Trial and commercial
 * licenses can be obtained at https://www.responsive.dev
 */

package dev.responsive.kafka.internal.db;

import dev.responsive.kafka.internal.stores.RemoteWriteResult;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

public class TTDWriter implements RemoteWriter {
  private final TTDTable table;
  private final P tablePartition;

  public TTDWriter(final TTDTable table, final P tablePartition) {
    this.table = table;
    this.tablePartition = tablePartition;
  }

  @SuppressWarnings("ResultOfMethodCallIgnored")
  @Override
  public void insert(final K key, final byte[] value, long epochMillis) {
    table.insert(0, key, value, epochMillis);
  }

  @SuppressWarnings("ResultOfMethodCallIgnored")
  @Override
  public void delete(final K key) {
    table.delete(0, key);
  }

  @Override
  public CompletionStage> flush() {
    return CompletableFuture.completedStage(RemoteWriteResult.success(tablePartition));
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy