Skip to content

Commit

Permalink
Update C++ API reflect OpenMessaging JavaAPI V1.0.0-preveiw
Browse files Browse the repository at this point in the history
  • Loading branch information
ShannonDing committed Sep 4, 2018
1 parent 3df1300 commit 9c287ac
Show file tree
Hide file tree
Showing 51 changed files with 1,449 additions and 1,141 deletions.
262 changes: 0 additions & 262 deletions BuiltinKeys.h

This file was deleted.

16 changes: 16 additions & 0 deletions ByteMessage.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* 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.
*/

#ifndef OMS_BYTE_MESSAGE_H
#define OMS_BYTE_MESSAGE_H

Expand Down
47 changes: 47 additions & 0 deletions Future.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* 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.
*/

#ifndef OMS_FUTURE_H
#define OMS_FUTURE_H

Expand All @@ -24,14 +40,45 @@ BEGIN_NAMESPACE_2(io, openmessaging)

}

/**
* Returns {@code true} if this task was cancelled before it completed normally.
*
* @return {@code true} if this task was cancelled before it completed
*/
virtual bool isCancelled() = 0;

/**
* Returns {@code true} if this task completed.
* <p>
* Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method
* will return {@code true}.
*
* @return {@code true} if this task completed
*/
virtual bool isDone() = 0;

/**
* Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if
* available.
*
* @param timeout the maximum time to wait
* @return the computed result <p> if the computation was cancelled
*/
virtual producer::SendResultPtr get(unsigned long timeout = LONG_MAX) = 0;

/**
* Adds the specified listener to this future. The specified listener is notified when this future is done. If this
* future is already completed, the specified listener will be notified immediately.
*
* @param listener FutureListener
*/
virtual Future &addListener(FutureListenerPtr listener) = 0;

/**
* Returns the cause of the failed future
*
* @return the cause of the failure. {@code null} if succeeded or this future is not completed yet.
*/
virtual std::exception &getThrowable() = 0;

};
Expand Down
20 changes: 20 additions & 0 deletions FutureListener.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* 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.
*/

#ifndef OMS_FUTURE_LISTENER_H
#define OMS_FUTURE_LISTENER_H

Expand All @@ -15,6 +31,10 @@ BEGIN_NAMESPACE_2(io, openmessaging)

}

/**
* Invoked when the operation completes, be the associated {@link Promise} successful or not.
* @param future The associated promise facade
*/
virtual void operationComplete(const Future& future) = 0;
};

Expand Down
Loading

0 comments on commit 9c287ac

Please sign in to comment.