public class GreptimeDB extends Object implements Write, WriteObject, BulkWrite, Health, Lifecycle<GreptimeOptions>, Display
BulkWrite.Config
Display.DefaultPrinter, Display.Printer
DEFAULT_ALLOCATOR_INIT_RESERVATION, DEFAULT_ALLOCATOR_MAX_ALLOCATION, DEFAULT_MAX_REQUESTS_IN_FLIGHT, DEFAULT_TIMEOUT_MS_PER_MESSAGE
Modifier and Type | Method and Description |
---|---|
BulkStreamWriter |
bulkStreamWriter(TableSchema schema,
long allocatorInitReservation,
long allocatorMaxAllocation,
long timeoutMsPerMessage,
int maxRequestsInFlight,
Context ctx)
Creates a bulk stream writer for efficiently writing data to the server.
|
CompletableFuture<Map<Endpoint,Boolean>> |
checkHealth() |
static GreptimeDB |
create(GreptimeOptions opts)
Creates a new
GreptimeDB instance. |
void |
display(Display.Printer out) |
void |
ensureInitialized() |
boolean |
init(GreptimeOptions opts) |
static List<GreptimeDB> |
instances()
Gets all instances of
GreptimeDB . |
StreamWriter<List<?>,WriteOk> |
objectsStreamWriter(int maxPointsPerSecond,
Context ctx)
Create a `Stream` to continuously write data to the database, typically used in data import
scenarios.
|
void |
shutdownGracefully() |
StreamWriter<Table,WriteOk> |
streamWriter(int maxPointsPerSecond,
Context ctx)
Create a `Stream` to continuously write data to the database, typically used in data import
scenarios.
|
String |
toString() |
CompletableFuture<Result<WriteOk,Err>> |
write(Collection<Table> tables,
WriteOp writeOp,
Context ctx)
Write multiple rows of data (which can belong to multiple tables) to the database at once.
|
CompletableFuture<Result<WriteOk,Err>> |
writeObjects(Collection<List<?>> objects,
WriteOp writeOp,
Context ctx)
Write multiple rows of data (which can belong to multiple tables) to the database at once.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
streamWriter, streamWriter, write, write, write
objectsStreamWriter, objectsStreamWriter, writeObjects, writeObjects, writeObjects
bulkStreamWriter, bulkStreamWriter, bulkStreamWriter
public static List<GreptimeDB> instances()
GreptimeDB
.GreptimeDB
public static GreptimeDB create(GreptimeOptions opts)
GreptimeDB
instance.opts
- the options for the GreptimeDB clientGreptimeDB
instanceRuntimeException
- if the GreptimeDB client fails to startpublic boolean init(GreptimeOptions opts)
init
in interface Lifecycle<GreptimeOptions>
public void shutdownGracefully()
shutdownGracefully
in interface Lifecycle<GreptimeOptions>
public void ensureInitialized()
ensureInitialized
in interface Lifecycle<GreptimeOptions>
public CompletableFuture<Result<WriteOk,Err>> writeObjects(Collection<List<?>> objects, WriteOp writeOp, Context ctx)
WriteObject
writeObjects
in interface WriteObject
objects
- a collection of data to be written, classified by tablewriteOp
- write operation(insert or delete)ctx
- invoke contextpublic StreamWriter<List<?>,WriteOk> objectsStreamWriter(int maxPointsPerSecond, Context ctx)
WriteObject
It is important to note that each write operation can write a List of POJOs. However, the POJO objects in the List must have the same type. If you need to write different types of POJO objects, you can perform multiple write operations on the `Stream`, dividing them into separate writes when you obtain the `Stream`.
objectsStreamWriter
in interface WriteObject
maxPointsPerSecond
- The max number of points that can be written per second,
exceeding which may cause blockage.ctx
- invoke contextpublic CompletableFuture<Result<WriteOk,Err>> write(Collection<Table> tables, WriteOp writeOp, Context ctx)
Write
public StreamWriter<Table,WriteOk> streamWriter(int maxPointsPerSecond, Context ctx)
Write
streamWriter
in interface Write
maxPointsPerSecond
- the max number of points that can be written per second,
exceeding which may cause blockagectx
- invoke contextpublic BulkStreamWriter bulkStreamWriter(TableSchema schema, long allocatorInitReservation, long allocatorMaxAllocation, long timeoutMsPerMessage, int maxRequestsInFlight, Context ctx)
BulkWrite
bulkStreamWriter
in interface BulkWrite
schema
- the schema of the tableallocatorInitReservation
- the initial space reservation (obtained from this allocator)allocatorMaxAllocation
- the maximum amount of space the new child allocator can allocatetimeoutMsPerMessage
- the timeout in milliseconds for each messagemaxRequestsInFlight
- the max in-flight requests in the streamctx
- invoke contextpublic CompletableFuture<Map<Endpoint,Boolean>> checkHealth()
checkHealth
in interface Health
public void display(Display.Printer out)
Copyright © 2025. All rights reserved.