com.kolibrifx.plovercrest.server.ReadObserver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plovercrest-server Show documentation
Show all versions of plovercrest-server Show documentation
Plovercrest server library.
The newest version!
/*
* Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
*/
package com.kolibrifx.plovercrest.server;
import java.nio.ByteBuffer;
public abstract class ReadObserver {
private long lastValidTimestamp = -1;
public abstract T observe(long timestamp, ByteBuffer bytes);
public void observeEnd(final long lastValidTimestamp) {
this.lastValidTimestamp = lastValidTimestamp;
}
/**
* Override to detect that a table has been frozen. This will only happen after observeEnd().
*/
public void observeFrozen() {
}
/**
* If the end of the stream has been observed, returns the last valid timestamp. Otherwise, -1
* is returned.
*/
public long getLastValidTimestamp() {
return lastValidTimestamp;
}
}