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.namequeues.request.NamedQueueGetRequest; 021import org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse; 022import org.apache.yetus.audience.InterfaceAudience; 023 024/** 025 * In-memory Queue service provider for multiple use-cases. Implementers should be registered in 026 * LogEventHandler 027 */ 028@InterfaceAudience.Private 029public interface NamedQueueService { 030 031 /** 032 * Retrieve event type for NamedQueueService implementation. 033 * @return {@link NamedQueuePayload.NamedQueueEvent} 034 */ 035 NamedQueuePayload.NamedQueueEvent getEvent(); 036 037 /** 038 * This implementation is generic for consuming records from LMAX disruptor and inserts records to 039 * EvictingQueue which is maintained by each ringbuffer provider. 040 * @param namedQueuePayload namedQueue payload from disruptor ring buffer 041 */ 042 void consumeEventFromDisruptor(NamedQueuePayload namedQueuePayload); 043 044 /** 045 * Cleans up queues maintained by services. 046 * @return true if slow log payloads are cleaned up, false otherwise 047 */ 048 boolean clearNamedQueue(); 049 050 /** 051 * Retrieve in memory queue records from ringbuffer 052 * @param request namedQueue request with event type 053 * @return queue records from ringbuffer after filter (if applied) 054 */ 055 NamedQueueGetResponse getNamedQueueRecords(NamedQueueGetRequest request); 056 057 /** 058 * Add all in memory queue records to system table. The implementors can use system table or 059 * direct HDFS file or ZK as persistence system. 060 */ 061 void persistAll(); 062}