Skip to content

Commit

Permalink
Enable CheckStyle Plugin in managed-ledger module (apache#13619)
Browse files Browse the repository at this point in the history
Motivation
Enable CheckStyle Plugin in managed-ledger module.

Documentation
- [x] `no-need-doc`
  • Loading branch information
liudezhi2098 authored Jan 12, 2022
1 parent 7f4583b commit 9032a9a
Show file tree
Hide file tree
Showing 107 changed files with 555 additions and 482 deletions.
2 changes: 1 addition & 1 deletion docker/pulsar/scripts/gen-yml-from-env.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@
conf.pop('processContainerFactory', None)

# Store back the updated config in the same file
f = open(conf_filename , 'w')
f = open(conf_filename, 'w')
yaml.dump(conf, f, default_flow_style=False)
f.close()
13 changes: 13 additions & 0 deletions managed-ledger/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>checkstyle</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
*/
package org.apache.bookkeeper.mledger;

import io.netty.buffer.ByteBuf;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import io.netty.buffer.ByteBuf;
import org.apache.bookkeeper.common.annotation.InterfaceAudience;
import org.apache.bookkeeper.common.annotation.InterfaceStability;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ enum OfferEntryResult {
CompletableFuture<OffloadResult> getOffloadResultAsync();

/**
* Manually close current offloading segment
* Manually close current offloading segment.
* @return true if the segment is not already closed
*/
boolean close();

default CompletableFuture<Boolean> AsyncClose() {
default CompletableFuture<Boolean> asyncClose() {
return CompletableFuture.completedFuture(close());
}
}
Expand Down Expand Up @@ -158,7 +158,8 @@ CompletableFuture<Void> offload(ReadHandle ledger,
* ensuring that subsequent calls will not attempt to offload the same ledger
* again.
*
* @return an OffloaderHandle, which when `completeFuture()` completed, denotes that the offload has been successful.
* @return an OffloaderHandle, which when `completeFuture()` completed, denotes that the offload has been
* successful.
*/
default CompletableFuture<OffloadHandle> streamingOffload(ManagedLedger ml, UUID uid, long beginLedger,
long beginEntry,
Expand Down Expand Up @@ -201,20 +202,19 @@ default CompletableFuture<ReadHandle> readOffloaded(long ledgerId, MLDataFormats
throw new UnsupportedOperationException();
}

default CompletableFuture<Void> deleteOffloaded(UUID uid,
Map<String, String> offloadDriverMetadata) {
default CompletableFuture<Void> deleteOffloaded(UUID uid, Map<String, String> offloadDriverMetadata) {
throw new UnsupportedOperationException();
}

/**
* Get offload policies of this LedgerOffloader
* Get offload policies of this LedgerOffloader.
*
* @return offload policies
*/
OffloadPoliciesImpl getOffloadPolicies();

/**
* Close the resources if necessary
* Close the resources if necessary.
*/
void close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

import com.google.common.base.Predicate;
import com.google.common.collect.Range;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.bookkeeper.common.annotation.InterfaceAudience;
import org.apache.bookkeeper.common.annotation.InterfaceStability;
import org.apache.bookkeeper.mledger.AsyncCallbacks.ClearBacklogCallback;
Expand Down Expand Up @@ -71,7 +69,7 @@ enum IndividualDeletedEntries {
long getLastActive();

/**
* Update the last active time of the cursor
* Update the last active time of the cursor.
*
*/
void updateLastActive();
Expand Down Expand Up @@ -476,7 +474,7 @@ void skipEntries(int numEntriesToSkip, IndividualDeletedEntries deletedEntries)
* opaque context
*/
void asyncSkipEntries(int numEntriesToSkip, IndividualDeletedEntries deletedEntries,
final SkipEntriesCallback callback, Object ctx);
SkipEntriesCallback callback, Object ctx);

/**
* Find the newest entry that matches the given predicate. Will only search among active entries
Expand All @@ -501,7 +499,8 @@ void asyncSkipEntries(int numEntriesToSkip, IndividualDeletedEntries deletedEntr
* @throws InterruptedException
* @throws ManagedLedgerException
*/
Position findNewestMatching(FindPositionConstraint constraint, Predicate<Entry> condition) throws InterruptedException, ManagedLedgerException;
Position findNewestMatching(FindPositionConstraint constraint, Predicate<Entry> condition)
throws InterruptedException, ManagedLedgerException;

/**
* Find the newest entry that matches the given predicate.
Expand All @@ -526,7 +525,7 @@ void asyncFindNewestMatching(FindPositionConstraint constraint, Predicate<Entry>
* @throws InterruptedException
* @throws ManagedLedgerException
*/
void resetCursor(final Position position) throws InterruptedException, ManagedLedgerException;
void resetCursor(Position position) throws InterruptedException, ManagedLedgerException;

/**
* reset the cursor to specified position to enable replay of messages.
Expand All @@ -536,7 +535,7 @@ void asyncFindNewestMatching(FindPositionConstraint constraint, Predicate<Entry>
* @param callback
* callback object
*/
void asyncResetCursor(final Position position, AsyncCallbacks.ResetCursorCallback callback);
void asyncResetCursor(Position position, AsyncCallbacks.ResetCursorCallback callback);

/**
* Read the specified set of positions from ManagedLedger.
Expand Down Expand Up @@ -657,7 +656,7 @@ Set<? extends Position> asyncReplayEntries(
int getNonContiguousDeletedMessagesRangeSerializedSize();

/**
* Returns the estimated size of the unacknowledged backlog for this cursor
* Returns the estimated size of the unacknowledged backlog for this cursor.
*
* @return the estimated size from the mark delete position of the cursor
*/
Expand All @@ -677,20 +676,20 @@ Set<? extends Position> asyncReplayEntries(
void setThrottleMarkDelete(double throttleMarkDelete);

/**
* Get {@link ManagedLedger} attached with cursor
* Get {@link ManagedLedger} attached with cursor.
*
* @return ManagedLedger
*/
ManagedLedger getManagedLedger();

/**
* Get last individual deleted range
* Get last individual deleted range.
* @return range
*/
Range<PositionImpl> getLastIndividualDeletedRange();

/**
* Trim delete entries for the given entries
* Trim delete entries for the given entries.
*/
void trimDeletedEntries(List<Entry> entries);

Expand All @@ -715,5 +714,5 @@ Set<? extends Position> asyncReplayEntries(
* Checks if the cursor is closed.
* @return whether this cursor is closed.
*/
public boolean isClosed();
boolean isClosed();
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ public interface ManagedLedger {
* @return the Position at which the entry has been inserted
* @throws ManagedLedgerException
*/
Position addEntry(byte[] data, int numberOfMessages, int offset, int length) throws InterruptedException, ManagedLedgerException;
Position addEntry(byte[] data, int numberOfMessages, int offset, int length) throws InterruptedException,
ManagedLedgerException;

/**
* Append a new entry asynchronously.
Expand Down Expand Up @@ -165,7 +166,8 @@ public interface ManagedLedger {
* @param ctx
* opaque context
*/
void asyncAddEntry(byte[] data, int numberOfMessages, int offset, int length, AddEntryCallback callback, Object ctx);
void asyncAddEntry(byte[] data, int numberOfMessages, int offset, int length, AddEntryCallback callback,
Object ctx);


/**
Expand Down Expand Up @@ -222,7 +224,8 @@ public interface ManagedLedger {
* @return the ManagedCursor
* @throws ManagedLedgerException
*/
ManagedCursor openCursor(String name, InitialPosition initialPosition) throws InterruptedException, ManagedLedgerException;
ManagedCursor openCursor(String name, InitialPosition initialPosition) throws InterruptedException,
ManagedLedgerException;

/**
* Open a ManagedCursor in this ManagedLedger.
Expand All @@ -240,7 +243,8 @@ public interface ManagedLedger {
* @return the ManagedCursor
* @throws ManagedLedgerException
*/
ManagedCursor openCursor(String name, InitialPosition initialPosition, Map<String, Long> properties) throws InterruptedException, ManagedLedgerException;
ManagedCursor openCursor(String name, InitialPosition initialPosition, Map<String, Long> properties)
throws InterruptedException, ManagedLedgerException;

/**
* Creates a new cursor whose metadata is not backed by durable storage. A caller can treat the non-durable cursor
Expand Down Expand Up @@ -331,10 +335,11 @@ ManagedCursor newNonDurableCursor(Position startPosition, String subscriptionNam
* @param ctx
* opaque context
*/
void asyncOpenCursor(String name, InitialPosition initialPosition, Map<String, Long> properties, OpenCursorCallback callback, Object ctx);
void asyncOpenCursor(String name, InitialPosition initialPosition, Map<String, Long> properties,
OpenCursorCallback callback, Object ctx);

/**
* Get a list of all the cursors reading from this ManagedLedger
* Get a list of all the cursors reading from this ManagedLedger.
*
* @return a list of cursors
*/
Expand Down Expand Up @@ -397,7 +402,7 @@ ManagedCursor newNonDurableCursor(Position startPosition, String subscriptionNam
CompletableFuture<Long> getEarliestMessagePublishTimeInBacklog();

/**
* Return the size of all ledgers offloaded to 2nd tier storage
* Return the size of all ledgers offloaded to 2nd tier storage.
*/
long getOffloadedSize();

Expand Down Expand Up @@ -535,7 +540,7 @@ ManagedCursor newNonDurableCursor(Position startPosition, String subscriptionNam
Position getLastConfirmedEntry();

/**
* Signaling managed ledger that we can resume after BK write failure
* Signaling managed ledger that we can resume after BK write failure.
*/
void readyToCreateNewLedger();

Expand Down Expand Up @@ -564,7 +569,7 @@ ManagedCursor newNonDurableCursor(Position startPosition, String subscriptionNam
* @param callback a callback which will be supplied with the newest properties in managedLedger.
* @param ctx a context object which will be passed to the callback on completion.
**/
void asyncSetProperty(String key, String value, final AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx);
void asyncSetProperty(String key, String value, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx);

/**
* Delete the property by key.
Expand All @@ -582,7 +587,7 @@ ManagedCursor newNonDurableCursor(Position startPosition, String subscriptionNam
* @param callback a callback which will be supplied with the newest properties in managedLedger.
* @param ctx a context object which will be passed to the callback on completion.
*/
void asyncDeleteProperty(String key, final AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx);
void asyncDeleteProperty(String key, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx);

/**
* Update managed-ledger's properties.
Expand All @@ -600,17 +605,17 @@ ManagedCursor newNonDurableCursor(Position startPosition, String subscriptionNam
* @param callback a callback which will be supplied with the newest properties in managedLedger.
* @param ctx a context object which will be passed to the callback on completion.
*/
void asyncSetProperties(Map<String, String> properties, final AsyncCallbacks.UpdatePropertiesCallback callback,
void asyncSetProperties(Map<String, String> properties, AsyncCallbacks.UpdatePropertiesCallback callback,
Object ctx);

/**
* Trim consumed ledgers in background
* Trim consumed ledgers in background.
* @param promise
*/
void trimConsumedLedgersInBackground(CompletableFuture<?> promise);

/**
* Roll current ledger if it is full
* Roll current ledger if it is full.
*/
@Deprecated
void rollCurrentLedgerIfFull();
Expand Down Expand Up @@ -638,7 +643,7 @@ void asyncSetProperties(Map<String, String> properties, final AsyncCallbacks.Upd
CompletableFuture<Void> asyncTruncate();

/**
* Get managed ledger internal stats
* Get managed ledger internal stats.
*
* @param includeLedgerMetadata the flag to control managed ledger internal stats include ledger metadata
* @return the future of managed ledger internal stats
Expand Down
Loading

0 comments on commit 9032a9a

Please sign in to comment.