2 * Copyright (c) 2024 PANTHEON.tech s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.keystore.plaintext.api;
10 import java.io.IOException;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.eclipse.jdt.annotation.Nullable;
15 * Mutable Plaintext Storage interface.
17 public interface MutablePlaintextStorage extends PlaintextStorage {
20 * Removes the mapping for a key from this storage if it is present.
22 * @param key key whose mapping is to be removed from the map
23 * @return the previous value associated with key, or null if there was no mapping for key
24 * @throws IOException on storage update error
26 byte @Nullable [] removeKey(byte @NonNull [] key) throws IOException;
29 * Removes the entry for the specified key only if it is currently mapped to the specified value.
31 * @param key key with which the specified value is associated
32 * @param value value expected to be associated with the specified key
33 * @return true if entry was removed, false otherwise
34 * @throws IOException on storage update error
36 boolean removeEntry(byte @NonNull [] key, byte @NonNull [] value) throws IOException;
39 * If the specified key is not already associated with a value associates it with the given value and returns null,
40 * else returns the current value.
42 * @param key key with which the specified value is to be associated
43 * @param value value to be associated with the specified key
44 * @return the previous value associated with the specified key, or null if there was no mapping for the key
45 * @throws IOException on storage update error
47 byte @Nullable [] insertEntry(byte @NonNull [] key, byte @NonNull [] value) throws IOException;
50 * Associates the specified value with the specified key.
52 * @param key key with which the specified value is to be associated
53 * @param value value to be associated with the specified key
54 * @return the previous value associated with key, or null if there was no mapping for key
55 * @throws IOException on storage update error
57 byte @Nullable [] putEntry(byte @NonNull [] key, byte @NonNull [] value) throws IOException;