com.alipay.disruptor.EventSink Maven / Gradle / Ivy
/*
* Copyright 2011 LMAX Ltd.
*
* Licensed 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 com.alipay.disruptor;
public interface EventSink {
/**
* Publishes an event to the ring buffer. It handles
* claiming the next sequence, getting the current (uninitialised)
* event from the ring buffer and publishing the claimed sequence
* after translation.
*
* @param translator The user specified translation for the event
*/
void publishEvent(EventTranslator translator);
/**
* Attempts to publish an event to the ring buffer. It handles
* claiming the next sequence, getting the current (uninitialised)
* event from the ring buffer and publishing the claimed sequence
* after translation. Will return false if specified capacity
* was not available.
*
* @param translator The user specified translation for the event
* @return true if the value was published, false if there was insufficient
* capacity.
*/
boolean tryPublishEvent(EventTranslator translator);
/**
* Allows one user supplied argument.
* @param translator The user specified translation for the event
* @param arg0 A user supplied argument.
* @param A user supplied argument.
* @see #publishEvent(EventTranslator)
*/
void publishEvent(EventTranslatorOneArg translator, A arg0);
/**
* Allows one user supplied argument.
*
* @param translator The user specified translation for the event
* @param arg0 A user supplied argument.
* @param A user supplied argument.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #tryPublishEvent(EventTranslator)
*/
boolean tryPublishEvent(EventTranslatorOneArg translator, A arg0);
/**
* Allows two user supplied arguments.
*
* @param translator The user specified translation for the event
* @param arg0 A user supplied argument.
* @param arg1 A user supplied argument.
* @param A user supplied argument.
* @param B user supplied argument.
* @see #publishEvent(EventTranslator)
*/
void publishEvent(EventTranslatorTwoArg translator, A arg0, B arg1);
/**
* Allows two user supplied arguments.
*
* @param translator The user specified translation for the event
* @param arg0 A user supplied argument.
* @param arg1 A user supplied argument.
* @param A user supplied argument.
* @param B user supplied argument.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #tryPublishEvent(EventTranslator)
*/
boolean tryPublishEvent(EventTranslatorTwoArg translator, A arg0, B arg1);
/**
* Allows three user supplied arguments
*
* @param translator The user specified translation for the event
* @param arg0 A user supplied argument.
* @param arg1 A user supplied argument.
* @param arg2 A user supplied argument.
* @param A user supplied argument.
* @param B user supplied argument.
* @param C user supplied argument.
* @see #publishEvent(EventTranslator)
*/
void publishEvent(EventTranslatorThreeArg translator, A arg0, B arg1,
C arg2);
/**
* Allows three user supplied arguments
*
* @param translator The user specified translation for the event
* @param arg0 A user supplied argument.
* @param arg1 A user supplied argument.
* @param arg2 A user supplied argument.
* @param A user supplied argument.
* @param B user supplied argument.
* @param C user supplied argument.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #publishEvent(EventTranslator)
*/
boolean tryPublishEvent(EventTranslatorThreeArg translator, A arg0,
B arg1, C arg2);
/**
* Allows a variable number of user supplied arguments
*
* @param translator The user specified translation for the event
* @param args User supplied arguments.
* @see #publishEvent(EventTranslator)
*/
void publishEvent(EventTranslatorVararg translator, Object... args);
/**
* Allows a variable number of user supplied arguments
*
* @param translator The user specified translation for the event
* @param args User supplied arguments.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #publishEvent(EventTranslator)
*/
boolean tryPublishEvent(EventTranslatorVararg translator, Object... args);
/**
* Publishes multiple events to the ring buffer. It handles
* claiming the next sequence, getting the current (uninitialised)
* event from the ring buffer and publishing the claimed sequence
* after translation.
*
* With this call the data that is to be inserted into the ring
* buffer will be a field (either explicitly or captured anonymously),
* therefore this call will require an instance of the translator
* for each value that is to be inserted into the ring buffer.
*
* @param translators The user specified translation for each event
*/
void publishEvents(EventTranslator[] translators);
/**
* Publishes multiple events to the ring buffer. It handles
* claiming the next sequence, getting the current (uninitialised)
* event from the ring buffer and publishing the claimed sequence
* after translation.
*
* With this call the data that is to be inserted into the ring
* buffer will be a field (either explicitly or captured anonymously),
* therefore this call will require an instance of the translator
* for each value that is to be inserted into the ring buffer.
*
* @param translators The user specified translation for each event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch
*/
void publishEvents(EventTranslator[] translators, int batchStartsAt, int batchSize);
/**
* Attempts to publish multiple events to the ring buffer. It handles
* claiming the next sequence, getting the current (uninitialised)
* event from the ring buffer and publishing the claimed sequence
* after translation. Will return false if specified capacity
* was not available.
*
* @param translators The user specified translation for the event
* @return true if the value was published, false if there was insufficient
* capacity.
*/
boolean tryPublishEvents(EventTranslator[] translators);
/**
* Attempts to publish multiple events to the ring buffer. It handles
* claiming the next sequence, getting the current (uninitialised)
* event from the ring buffer and publishing the claimed sequence
* after translation. Will return false if specified capacity
* was not available.
*
* @param translators The user specified translation for the event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch
* @return true if all the values were published, false if there was insufficient
* capacity.
*/
boolean tryPublishEvents(EventTranslator[] translators, int batchStartsAt, int batchSize);
/**
* Allows one user supplied argument per event.
*
* @param translator The user specified translation for the event
* @param arg0 A user supplied argument.
* @param A user supplied argument.
* @see #publishEvents(com.alipay.disruptor.EventTranslator[])
*/
void publishEvents(EventTranslatorOneArg translator, A[] arg0);
/**
* Allows one user supplied argument per event.
*
* @param translator The user specified translation for each event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch
* @param arg0 An array of user supplied arguments, one element per event.
* @param A user supplied argument.
* @see #publishEvents(EventTranslator[])
*/
void publishEvents(EventTranslatorOneArg translator, int batchStartsAt,
int batchSize, A[] arg0);
/**
* Allows one user supplied argument.
*
* @param translator The user specified translation for each event
* @param arg0 An array of user supplied arguments, one element per event.
* @param A user supplied argument.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #tryPublishEvents(com.alipay.disruptor.EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorOneArg translator, A[] arg0);
/**
* Allows one user supplied argument.
*
* @param translator The user specified translation for each event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch
* @param arg0 An array of user supplied arguments, one element per event.
* @param A user supplied argument.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #tryPublishEvents(EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorOneArg translator, int batchStartsAt,
int batchSize, A[] arg0);
/**
* Allows two user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param A user supplied argument.
* @param B user supplied argument.
* @see #publishEvents(com.alipay.disruptor.EventTranslator[])
*/
void publishEvents(EventTranslatorTwoArg translator, A[] arg0, B[] arg1);
/**
* Allows two user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch.
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @see #publishEvents(EventTranslator[])
*/
void publishEvents(EventTranslatorTwoArg translator, int batchStartsAt,
int batchSize, A[] arg0, B[] arg1);
/**
* Allows two user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #tryPublishEvents(com.alipay.disruptor.EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorTwoArg translator, A[] arg0, B[] arg1);
/**
* Allows two user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch.
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #tryPublishEvents(EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorTwoArg translator, int batchStartsAt,
int batchSize, A[] arg0, B[] arg1);
/**
* Allows three user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param arg2 An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @see #publishEvents(com.alipay.disruptor.EventTranslator[])
*/
void publishEvents(EventTranslatorThreeArg translator, A[] arg0,
B[] arg1, C[] arg2);
/**
* Allows three user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The number of elements in the batch.
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param arg2 An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @see #publishEvents(EventTranslator[])
*/
void publishEvents(EventTranslatorThreeArg translator, int batchStartsAt,
int batchSize, A[] arg0, B[] arg1, C[] arg2);
/**
* Allows three user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param arg2 An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #publishEvents(com.alipay.disruptor.EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorThreeArg translator, A[] arg0,
B[] arg1, C[] arg2);
/**
* Allows three user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch.
* @param arg0 An array of user supplied arguments, one element per event.
* @param arg1 An array of user supplied arguments, one element per event.
* @param arg2 An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @param An array of user supplied arguments, one element per event.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #publishEvents(EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorThreeArg translator,
int batchStartsAt, int batchSize, A[] arg0, B[] arg1,
C[] arg2);
/**
* Allows a variable number of user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param args User supplied arguments, one Object[] per event.
* @see #publishEvents(com.alipay.disruptor.EventTranslator[])
*/
void publishEvents(EventTranslatorVararg translator, Object[]... args);
/**
* Allows a variable number of user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch
* @param args User supplied arguments, one Object[] per event.
* @see #publishEvents(EventTranslator[])
*/
void publishEvents(EventTranslatorVararg translator, int batchStartsAt, int batchSize,
Object[]... args);
/**
* Allows a variable number of user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param args User supplied arguments, one Object[] per event.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #publishEvents(com.alipay.disruptor.EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorVararg translator, Object[]... args);
/**
* Allows a variable number of user supplied arguments per event.
*
* @param translator The user specified translation for the event
* @param batchStartsAt The first element of the array which is within the batch.
* @param batchSize The actual size of the batch.
* @param args User supplied arguments, one Object[] per event.
* @return true if the value was published, false if there was insufficient
* capacity.
* @see #publishEvents(EventTranslator[])
*/
boolean tryPublishEvents(EventTranslatorVararg translator, int batchStartsAt, int batchSize,
Object[]... args);
}