1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.regionserver;
20
21 import com.google.common.annotations.VisibleForTesting;
22
23 import java.util.Collection;
24 import java.util.Comparator;
25 import java.util.Iterator;
26 import java.util.NavigableSet;
27 import java.util.SortedSet;
28 import java.util.concurrent.ConcurrentNavigableMap;
29 import java.util.concurrent.ConcurrentSkipListMap;
30
31 import org.apache.hadoop.hbase.Cell;
32 import org.apache.hadoop.hbase.KeyValue;
33 import org.apache.hadoop.hbase.classification.InterfaceAudience;
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 @InterfaceAudience.Private
50 public class CellSkipListSet implements NavigableSet<Cell> {
51 private final ConcurrentNavigableMap<Cell, Cell> delegatee;
52
53 CellSkipListSet(final KeyValue.KVComparator c) {
54 this.delegatee = new ConcurrentSkipListMap<Cell, Cell>(c);
55 }
56
57 CellSkipListSet(final ConcurrentNavigableMap<Cell, Cell> m) {
58 this.delegatee = m;
59 }
60
61 public Cell ceiling(Cell e) {
62 throw new UnsupportedOperationException("Not implemented");
63 }
64
65 public Iterator<Cell> descendingIterator() {
66 return this.delegatee.descendingMap().values().iterator();
67 }
68
69 public NavigableSet<Cell> descendingSet() {
70 throw new UnsupportedOperationException("Not implemented");
71 }
72
73 public Cell floor(Cell e) {
74 throw new UnsupportedOperationException("Not implemented");
75 }
76
77 public SortedSet<Cell> headSet(final Cell toElement) {
78 return headSet(toElement, false);
79 }
80
81 public NavigableSet<Cell> headSet(final Cell toElement,
82 boolean inclusive) {
83 return new CellSkipListSet(this.delegatee.headMap(toElement, inclusive));
84 }
85
86 public Cell higher(Cell e) {
87 throw new UnsupportedOperationException("Not implemented");
88 }
89
90 public Iterator<Cell> iterator() {
91 return this.delegatee.values().iterator();
92 }
93
94 public Cell lower(Cell e) {
95 throw new UnsupportedOperationException("Not implemented");
96 }
97
98 public Cell pollFirst() {
99 throw new UnsupportedOperationException("Not implemented");
100 }
101
102 public Cell pollLast() {
103 throw new UnsupportedOperationException("Not implemented");
104 }
105
106 public SortedSet<Cell> subSet(Cell fromElement, Cell toElement) {
107 throw new UnsupportedOperationException("Not implemented");
108 }
109
110 public NavigableSet<Cell> subSet(Cell fromElement,
111 boolean fromInclusive, Cell toElement, boolean toInclusive) {
112 throw new UnsupportedOperationException("Not implemented");
113 }
114
115 public SortedSet<Cell> tailSet(Cell fromElement) {
116 return tailSet(fromElement, true);
117 }
118
119 public NavigableSet<Cell> tailSet(Cell fromElement, boolean inclusive) {
120 return new CellSkipListSet(this.delegatee.tailMap(fromElement, inclusive));
121 }
122
123 public Comparator<? super Cell> comparator() {
124 throw new UnsupportedOperationException("Not implemented");
125 }
126
127 public Cell first() {
128 return this.delegatee.get(this.delegatee.firstKey());
129 }
130
131 public Cell last() {
132 return this.delegatee.get(this.delegatee.lastKey());
133 }
134
135 public boolean add(Cell e) {
136 return this.delegatee.put(e, e) == null;
137 }
138
139 public boolean addAll(Collection<? extends Cell> c) {
140 throw new UnsupportedOperationException("Not implemented");
141 }
142
143 public void clear() {
144 this.delegatee.clear();
145 }
146
147 public boolean contains(Object o) {
148
149 return this.delegatee.containsKey(o);
150 }
151
152 public boolean containsAll(Collection<?> c) {
153 throw new UnsupportedOperationException("Not implemented");
154 }
155
156 public boolean isEmpty() {
157 return this.delegatee.isEmpty();
158 }
159
160 public boolean remove(Object o) {
161 return this.delegatee.remove(o) != null;
162 }
163
164 public boolean removeAll(Collection<?> c) {
165 throw new UnsupportedOperationException("Not implemented");
166 }
167
168 public boolean retainAll(Collection<?> c) {
169 throw new UnsupportedOperationException("Not implemented");
170 }
171
172 public Cell get(Cell kv) {
173 return this.delegatee.get(kv);
174 }
175
176 public int size() {
177 if (delegatee instanceof ConcurrentSkipListMap) {
178 throw new UnsupportedOperationException("ConcurrentSkipListMap.size() is time-consuming");
179 }
180 return this.delegatee.size();
181 }
182
183 public Object[] toArray() {
184 throw new UnsupportedOperationException("Not implemented");
185 }
186
187 public <T> T[] toArray(T[] a) {
188 throw new UnsupportedOperationException("Not implemented");
189 }
190
191 @VisibleForTesting
192 int sizeForTests() {
193 return this.delegatee.size();
194 }
195 }