org.apache.ignite.internal.processors.metastorage

## Interface DistributedMetaStorage

All Superinterfaces:
  ReadableDistributedMetaStorage

All Known Implementing Classes:
  DistributedMetaStorageImpl

    public interface DistributedMetaStorage
    extends ReadableDistributedMetaStorage

API for distributed data storage with the ability to write into it.

See Also:
  `ReadableDistributedMetaStorage`

### Field Summary

Fields
`static String` `IGNITE_INTERNAL_KEY_PREFIX` Prefix for keys in metastorage used by Ignite internally.

### Method Summary

All Methods Instance Methods Abstract Methods
`boolean` `compareAndRemove(@NotNull String key, @NotNull Serializable expVal)` Remove value from distributed metastorage but only if current value matches the expected one.
`boolean` `compareAndSet(@NotNull String key, @Nullable Serializable expVal, @NotNull Serializable newVal)` Write value into distributed metastorage but only if current value matches the expected one.
`GridFutureAdapter<Boolean>` `compareAndSetAsync(@NotNull String key, @Nullable Serializable expVal, @NotNull Serializable newVal)` Write value into distributed metastorage asynchronously but only if current value matches the expected one.
`void` `remove(@NotNull String key)` Remove value from distributed metastorage.
`GridFutureAdapter<?>` `removeAsync(@NotNull String key)` Remove value from distributed metastorage asynchronously.
`void` `write(@NotNull String key, @NotNull Serializable val)` Write value into distributed metastorage.
`GridFutureAdapter<?>` `writeAsync(@NotNull String key, @NotNull Serializable val)` Write value into distributed metastorage asynchronously.

### Methods inherited from interface org.apache.ignite.internal.processors.metastorage.ReadableDistributedMetaStorage

`getUpdatesCount, isSupported, iterate, listen, read`

### Field Detail

#### IGNITE_INTERNAL_KEY_PREFIX

    static final String IGNITE_INTERNAL_KEY_PREFIX

Prefix for keys in metastorage used by Ignite internally. No user keys should start with this prefix.

See Also:
  Constant Field Values

### Method Detail

#### write

    void write(@NotNull
               @NotNull String key,
               @NotNull
               @NotNull Serializable val)
        throws IgniteCheckedException

Write value into distributed metastorage.

Parameters:
  `key` - The key.
  `val` - Value to write. Must not be null.
Throws:
  `IgniteCheckedException` - In case of marshalling error or some other unexpected exception.

#### writeAsync

    GridFutureAdapter<?> writeAsync(@NotNull
                                    @NotNull String key,
                                    @NotNull
                                    @NotNull Serializable val)
                             throws IgniteCheckedException

Write value into distributed metastorage asynchronously.

Parameters:
  `key` - The key.
  `val` - Value to write. Must not be null.
Returns:
  Future with the operation result.
Throws:
  `IgniteCheckedException` - In case of marshalling error or some other unexpected exception.

#### removeAsync

    GridFutureAdapter<?> removeAsync(@NotNull
                                     @NotNull String key)
                              throws IgniteCheckedException

Remove value from distributed metastorage asynchronously.

Parameters:
  `key` - The key.
Returns:
  Future with the operation result.
Throws:
  `IgniteCheckedException` - In case of marshalling error or some other unexpected exception.

#### remove

    void remove(@NotNull
                @NotNull String key)
         throws IgniteCheckedException

Remove value from distributed metastorage.

Parameters:
  `key` - The key.
Throws:
  `IgniteCheckedException` - In case of marshalling error or some other unexpected exception.

#### compareAndSet

    boolean compareAndSet(@NotNull
                          @NotNull String key,
                          @Nullable
                          @Nullable Serializable expVal,
                          @NotNull
                          @NotNull Serializable newVal)
                   throws IgniteCheckedException

Write value into distributed metastorage but only if current value matches the expected one.

Parameters:
  `key` - The key.
  `expVal` - Expected value. Might be null.
  `newVal` - Value to write. Must not be null.
Returns:
  `True` if expected value matched the actual one and write was completed successfully. `False` otherwise.
Throws:
  `IgniteCheckedException` - In case of marshalling error or some other unexpected exception.

#### compareAndSetAsync

    GridFutureAdapter<Boolean> compareAndSetAsync(@NotNull
                                                  @NotNull String key,
                                                  @Nullable
                                                  @Nullable Serializable expVal,
                                                  @NotNull
                                                  @NotNull Serializable newVal)
                                           throws IgniteCheckedException

Write value into distributed metastorage asynchronously but only if current value matches the expected one.

Parameters:
  `key` - The key.
  `expVal` - Expected value. Might be null.
  `newVal` - Value to write. Must not be null.
Returns:
  `True` if expected value matched the actual one and write was completed successfully. `False` otherwise.
Throws:
  `IgniteCheckedException` - In case of marshalling error or some other unexpected exception.

#### compareAndRemove

    boolean compareAndRemove(@NotNull
                             @NotNull String key,
                             @NotNull
                             @NotNull Serializable expVal)
                      throws IgniteCheckedException

Remove value from distributed metastorage but only if current value matches the expected one.

Parameters:
  `key` - The key.
  `expVal` - Expected value. Must not be null.
Returns:
  `True` if expected value matched the actual one and remove was completed successfully. `False` otherwise.
Throws:
  `IgniteCheckedException` - In case of marshalling error or some other unexpected exception.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020