forked from apache/bookkeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE apache#550: add readLastAddConfirmedAndEntry in ReadHandle for …
…long poll read Descriptions of the changes in this PR: 1, add a class LastAddConfirmedAndEntry and metnod readLastAddConfirmedAndEntry() in ReadHandle; 2, add implementation for readLastAddConfirmedAndEntry in LedgerHandler; 3, add testcase in BookKeeperApiTest; 4, remove un-used imports, break down long lines, fix wrong comments. Author: Jia Zhai <zhaijia@apache.org> Reviewers: Enrico Olivelli <eolivelli@gmail.com>, Sijie Guo <sijie@apache.org>, Venkateswararao Jujjuri (JV) <None> This closes apache#729 from zhaijack/issue-550, closes apache#550
- Loading branch information
Showing
6 changed files
with
183 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/api/LastConfirmedAndEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
*/ | ||
package org.apache.bookkeeper.client.api; | ||
|
||
/** | ||
* This contains LastAddConfirmed entryId and a LedgerEntry wanted to read. | ||
* It is used for readLastAddConfirmedAndEntry. | ||
*/ | ||
public interface LastConfirmedAndEntry { | ||
|
||
/** | ||
* Gets LastAddConfirmed entryId. | ||
* | ||
* @return the LastAddConfirmed | ||
*/ | ||
Long getLastAddConfirmed(); | ||
|
||
/** | ||
* Whether this entity contains an entry. | ||
* | ||
* @return true if Entry not null | ||
*/ | ||
boolean hasEntry(); | ||
|
||
/** | ||
* Gets wanted LedgerEntry. | ||
* | ||
* @return the LedgerEntry | ||
*/ | ||
LedgerEntry getEntry(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...per-server/src/main/java/org/apache/bookkeeper/client/impl/LastConfirmedAndEntryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
*/ | ||
package org.apache.bookkeeper.client.impl; | ||
|
||
import org.apache.bookkeeper.client.api.LastConfirmedAndEntry; | ||
import org.apache.bookkeeper.client.api.LedgerEntry; | ||
|
||
/** | ||
* This contains LastAddConfirmed entryId and a LedgerEntry wanted to read. | ||
* It is used for readLastAddConfirmedAndEntry. | ||
*/ | ||
public class LastConfirmedAndEntryImpl implements LastConfirmedAndEntry { | ||
|
||
private final Long lac; | ||
private final LedgerEntry entry; | ||
|
||
public LastConfirmedAndEntryImpl(Long lac, LedgerEntry entry) { | ||
this.lac = lac; | ||
this.entry = entry; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public Long getLastAddConfirmed() { | ||
return lac; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public boolean hasEntry() { | ||
return entry != null; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public LedgerEntry getEntry() { | ||
return entry; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters