001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.namequeues; 019 020import org.apache.hadoop.hbase.client.Connection; 021import org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest; 022import org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse; 023import org.apache.yetus.audience.InterfaceAudience; 024 025/** 026 * In-memory Queue service provider for multiple use-cases. Implementers should be registered in 027 * LogEventHandler 028 */ 029@InterfaceAudience.Private 030public interface NamedQueueService { 031 032 /** 033 * Retrieve event type for NamedQueueService implementation. 034 * @return {@link NamedQueuePayload.NamedQueueEvent} 035 */ 036 NamedQueuePayload.NamedQueueEvent getEvent(); 037 038 /** 039 * This implementation is generic for consuming records from LMAX disruptor and inserts records to 040 * EvictingQueue which is maintained by each ringbuffer provider. 041 * @param namedQueuePayload namedQueue payload from disruptor ring buffer 042 */ 043 void consumeEventFromDisruptor(NamedQueuePayload namedQueuePayload); 044 045 /** 046 * Cleans up queues maintained by services. 047 * @return true if slow log payloads are cleaned up, false otherwise 048 */ 049 boolean clearNamedQueue(); 050 051 /** 052 * Retrieve in memory queue records from ringbuffer 053 * @param request namedQueue request with event type 054 * @return queue records from ringbuffer after filter (if applied) 055 */ 056 NamedQueueGetResponse getNamedQueueRecords(NamedQueueGetRequest request); 057 058 /** 059 * Add all in memory queue records to system table. The implementors can use system table or 060 * direct HDFS file or ZK as persistence system. 061 */ 062 void persistAll(Connection connection); 063}