Improve LocalProxyTransaction.doExists()
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / actors / dds / SimpleDataStoreClientBehavior.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.databroker.actors.dds;
9
10 import java.util.stream.Stream;
11 import org.opendaylight.controller.cluster.access.client.ClientActorContext;
12 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14
15 /**
16  * {@link AbstractDataStoreClientBehavior} which connects to a single shard only.
17  *
18  * @author Robert Varga
19  */
20 final class SimpleDataStoreClientBehavior extends AbstractDataStoreClientBehavior {
21     // Pre-boxed instance
22     private static final Long ZERO = 0L;
23
24     private SimpleDataStoreClientBehavior(final ClientActorContext context,
25             final SimpleShardBackendResolver resolver) {
26         super(context, resolver);
27     }
28
29     SimpleDataStoreClientBehavior(final ClientActorContext context, final ActorUtils actorUtils,
30             final String shardName) {
31         this(context, new SimpleShardBackendResolver(context.getIdentifier(), actorUtils, shardName));
32     }
33
34     @Override
35     Long resolveShardForPath(final YangInstanceIdentifier path) {
36         return ZERO;
37     }
38
39     @Override
40     Stream<Long> resolveAllShards() {
41         return Stream.of(ZERO);
42     }
43 }