1 /*-
2  * Copyright (c) 2000, 2020 Oracle and/or its affiliates.  All rights reserved.
3  *
4  * See the file LICENSE for license information.
5  *
6  */
7 
8 package com.sleepycat.collections;
9 
10 import com.sleepycat.db.DatabaseEntry;
11 import com.sleepycat.db.DatabaseException;
12 
13 /**
14  * An interface implemented to assign new primary key values.
15  * An implementation of this interface is passed to the {@link StoredMap}
16  * or {@link StoredSortedMap} constructor to assign primary keys for that
17  * store. Key assignment occurs when <code>StoredMap.append()</code> is called.
18  *
19  * @author Mark Hayes
20  */
21 public interface PrimaryKeyAssigner {
22 
23     /**
24      * Assigns a new primary key value into the given buffer.
25      *
26      * @param keyData the buffer.
27      *
28      * @throws DatabaseException to stop the operation and cause this exception
29      * to be propagated to the caller of <code>StoredMap.append()</code>.
30      */
assignKey(DatabaseEntry keyData)31     void assignKey(DatabaseEntry keyData)
32         throws DatabaseException;
33 }
34