9ae6c289da8b01cf05b68811d1880515a2ad4169
[flume.git] / flume-ng-sinks / flume-ng-hbase-sink / src / main / java / org / apache / flume / sink / hbase / AsyncHbaseEventSerializer.java
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.flume.sink.hbase;
20
21 import java.util.List;
22
23 import org.apache.flume.Event;
24 import org.apache.flume.conf.Configurable;
25 import org.apache.flume.conf.ConfigurableComponent;
26 import org.hbase.async.AtomicIncrementRequest;
27 import org.hbase.async.PutRequest;
28
29 /**
30 * Interface for an event serializer which serializes the headers and body
31 * of an event to write them to hbase. This is configurable, so any config
32 * params required should be taken through this.
33 * The table should be valid on the column family. An implementation
34 * of this interface is expected by the {@linkplain AsyncHBaseSink} to serialize
35 * the events.
36 */
37 public interface AsyncHbaseEventSerializer extends Configurable,
38 ConfigurableComponent {
39
40 /**
41 * Initialize the event serializer.
42 * @param table - The table the serializer should use when creating
43 * {@link org.hbase.async.PutRequest} or
44 * {@link org.hbase.async.AtomicIncrementRequest}.
45 * @param cf - The column family to be used.
46 */
47 public void initialize(byte[] table, byte[] cf);
48
49 /**
50 * @param Event to be written to HBase.
51 */
52 public void setEvent(Event event);
53
54 /**
55 * Get the actions that should be written out to hbase as a result of this
56 * event. This list is written to hbase.
57 * @return List of {@link org.hbase.async.PutRequest} which
58 * are written as such to HBase.
59 *
60 *
61 */
62 public List<PutRequest> getActions();
63
64 /**
65 * Get the increments that should be made in hbase as a result of this
66 * event. This list is written to hbase.
67 * @return List of {@link org.hbase.async.AtomicIncrementRequest} which
68 * are written as such to HBase.
69 *
70 *
71 */
72 public List<AtomicIncrementRequest> getIncrements();
73
74 /**
75 * Clean up any state. This will be called when the sink is being stopped.
76 */
77 public void cleanUp();
78 }

Copyright 2016, The Apache Software Foundation.