package leigh.chain.directory;

import java.time.Instant;
import java.util.Set;

/**
 * Classes implementing this interface provides storage for the directory state.
 *
 * @author Alex Leigh
 */
public interface DirectoryStore {
    /**
     * Return the {@link Identity} record for the given name if a valid current claim exists. If there was a valid claim
     * that is expired at the time this method is invoked, then <code>null</code> will be returned.
     */
    Identity getIdentityByName(String name, Instant when);

    /**
     * Return the {@link Identity} record for the given address, if it exists in the store.
     */
    Identity getIdentityByAddr(String address);

    /**
     * Store a new identity. This method assumes the identity is trusted (is verified and correct).
     */
    void putIdentity(Identity id);

    void removeName(String name);

    public Set<String> getNames();
}
