以Apache AsterixDB™ is a scalable, open source Big Data Management System (BDMS).为例:

树索引帧

  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.hyracks.storage.am.btree.api;
  20. import org.apache.hyracks.api.exceptions.HyracksDataException;
  21. import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
  22. import org.apache.hyracks.storage.am.btree.impls.BTreeOpContext.PageValidationInfo;
  23. import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame;
  24. public interface IBTreeFrame extends ITreeIndexFrame {
  25. public int findInsertTupleIndex(ITupleReference tuple) throws HyracksDataException;
  26. public int findDeleteTupleIndex(ITupleReference tuple) throws HyracksDataException;
  27. public void insertSorted(ITupleReference tuple) throws HyracksDataException;
  28. public void setSmFlag(boolean smFlag);
  29. public boolean getSmFlag();
  30. public void setLargeFlag(boolean largePage);
  31. public boolean getLargeFlag();
  32. public void validate(PageValidationInfo pvi) throws HyracksDataException;
  33. }

内部节点

  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.hyracks.storage.am.btree.api;
  20. import org.apache.hyracks.api.exceptions.HyracksDataException;
  21. import org.apache.hyracks.storage.am.btree.impls.RangePredicate;
  22. public interface IBTreeInteriorFrame extends IBTreeFrame {
  23. public int getChildPageId(RangePredicate pred) throws HyracksDataException;
  24. public int getLeftmostChildPageId();
  25. public int getRightmostChildPageId();
  26. public void setRightmostChildPageId(int pageId);
  27. public void deleteGreatest();
  28. }

叶子节点

  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.hyracks.storage.am.btree.api;
  20. import org.apache.hyracks.api.exceptions.HyracksDataException;
  21. import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
  22. import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference;
  23. import org.apache.hyracks.storage.am.common.ophelpers.FindTupleMode;
  24. import org.apache.hyracks.storage.am.common.ophelpers.FindTupleNoExactMatchPolicy;
  25. import org.apache.hyracks.storage.common.MultiComparator;
  26. import org.apache.hyracks.storage.common.buffercache.IBufferCache;
  27. import org.apache.hyracks.storage.common.buffercache.IExtraPageBlockHelper;
  28. public interface IBTreeLeafFrame extends IBTreeFrame {
  29. public int findTupleIndex(ITupleReference searchKey, ITreeIndexTupleReference pageTuple, MultiComparator cmp,
  30. FindTupleMode ftm, FindTupleNoExactMatchPolicy ftp) throws HyracksDataException;
  31. public int findTupleIndex(ITupleReference searchKey, ITreeIndexTupleReference pageTuple, MultiComparator cmp,
  32. int startIndex) throws HyracksDataException;
  33. public int findUpdateTupleIndex(ITupleReference tuple) throws HyracksDataException;
  34. public int findUpsertTupleIndex(ITupleReference tuple) throws HyracksDataException;
  35. /**
  36. * @param searchTuple
  37. * the tuple to match
  38. * @param targetTupleIndex
  39. * the index of the tuple to check
  40. * @return the tuple at targetTupleIndex if its keys match searchTuple's keys, otherwise null
  41. * @throws HyracksDataException
  42. */
  43. public ITupleReference getMatchingKeyTuple(ITupleReference searchTuple, int targetTupleIndex)
  44. throws HyracksDataException;
  45. public void setNextLeaf(int nextPage);
  46. public int getNextLeaf();
  47. void ensureCapacity(IBufferCache bufferCache, ITupleReference tuple, IExtraPageBlockHelper extraPageBlockHelper)
  48. throws HyracksDataException;
  49. }