[ 
https://issues.apache.org/jira/browse/BEAM-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15857350#comment-15857350
 ] 

Jingsong Lee edited comment on BEAM-42 at 2/8/17 4:02 AM:
----------------------------------------------------------

MapState maybe need more "sighted write"(contrary to "blind write"). There are 
also interfaces to be discussed.
{code:title=Bar.java|borderStyle=solid}
/**
 * An object that maps keys to values.
 * A map cannot contain duplicate keys;
 * each key can map to at most one value.
 *
 * @param <K> the type of keys maintained by this map
 * @param <V> the type of mapped values
 */
public interface MapState<K, V> extends ReadableState<Iterable<Map.Entry<K, 
V>>>, State {

  V get(K key);

  void put(K key, V value);

  V putIfAbsent(K key, V value);

  void remove(K key);

  Iterable<K> keys();

  Iterable<V> values();

  @Override
  MapState<K, V> readLater();
}
{code}



was (Author: lzljs3620320):
MapState maybe need more "sighted write"(contrary to "blind write"). There are 
also interfaces to be discussed.
{code:title=Bar.java|borderStyle=solid}
/**
 * An object that maps keys to values.
 * A map cannot contain duplicate keys;
 * each key can map to at most one value.
 *
 * @param <K> the type of keys maintained by this map
 * @param <V> the type of mapped values
 */
public interface MapState<K, V> extends ReadableState<Iterator<Map.Entry<K, 
V>>>, State {

  V get(K key);

  void put(K key, V value);

  V putIfAbsent(K key, V value);

  void remove(K key);

  Iterable<K> keys();

  Iterable<V> values();

  @Override
  MapState<K, V> readLater();
}
{code}


> State for "Map" data, supporting efficient key lookup, etc.
> -----------------------------------------------------------
>
>                 Key: BEAM-42
>                 URL: https://issues.apache.org/jira/browse/BEAM-42
>             Project: Beam
>          Issue Type: New Feature
>          Components: beam-model
>            Reporter: Kenneth Knowles
>            Assignee: Kenneth Knowles
>            Priority: Minor
>              Labels: State
>
> Analogous to BagState's blind writes, and SetState's efficient membership 
> check, MapState would add efficient key lookup and mutation, and other 
> Map-related operations.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to