1 /*-
2  * Copyright (c) 2001, 2020 Oracle and/or its affiliates.  All rights reserved.
3  *
4  * See the file LICENSE for license information.
5  *
6  * $Id$
7  */
8 
9 package com.sleepycat.db;
10 
11 /**
12 An interface specifying how to set up database partitioning.
13 Implementation of this interface is required when
14 {@link com.sleepycat.db.Database} is opened and
15 {@link DatabaseConfig#setPartitionByCallback DatabaseConfig.setPartitionByCallback} is called.
16 <p>
17 You configure the database with this handler using the
18 {@link DatabaseConfig#setPartitionByCallback DatabaseConfig.setPartitionByCallback} method.
19 */
20 public interface PartitionHandler {
21     /**
22     The application-specific database partitioning callback.
23     <p>
24     @param db
25     The enclosing database handle.
26     @param key
27     A database entry representing a database key.
28     @return
29     A partition number for the key.
30     */
partition(Database db, DatabaseEntry key)31     int partition(Database db, DatabaseEntry key);
32 }
33