• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java KryoNamespace类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.onlab.util.KryoNamespace的典型用法代码示例。如果您正苦于以下问题:Java KryoNamespace类的具体用法?Java KryoNamespace怎么用?Java KryoNamespace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

KryoNamespace类属于org.onlab.util包,在下文中一共展示了KryoNamespace类的32个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder()
            .register(KryoNamespaces.API)
            .register(UiTopoLayoutId.class)
            .register(UiTopoLayout.class);

    layouts = storageService.<UiTopoLayoutId, UiTopoLayout>consistentMapBuilder()
            .withSerializer(Serializer.using(kryoBuilder.build()))
            .withName("onos-topo-layouts")
            .withRelaxedReadConsistency()
            .build();
    layoutMap = layouts.asJavaMap();

    // Create and add the default layout, if needed.
    layoutMap.computeIfAbsent(DEFAULT_ID, k -> new UiTopoLayout(k, null, null));

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:20,
代码来源:UiTopoLayoutManager.java

示例2: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    KryoNamespace kryo = new KryoNamespace.Builder()
            .register(KryoNamespaces.API)
            .register(Bmv2TableEntryReference.class)
            .register(Bmv2MatchKey.class)
            .register(Bmv2ExactMatchParam.class)
            .register(Bmv2TernaryMatchParam.class)
            .register(Bmv2LpmMatchParam.class)
            .register(Bmv2ValidMatchParam.class)
            .register(Bmv2FlowRuleWrapper.class)
            .build();

    flowRules = storageService.<Bmv2TableEntryReference, Bmv2FlowRuleWrapper>eventuallyConsistentMapBuilder()
            .withSerializer(kryo)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .withName("onos-bmv2-flowrules")
            .build();

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:22,
代码来源:Bmv2TableEntryServiceImpl.java

示例3: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class);
    tunnelIdAsKeyStore = storageService
            .<TunnelId, Tunnel>eventuallyConsistentMapBuilder()
            .withName("all_tunnel").withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    orderRelationship = storageService
            .<ApplicationId, Set<TunnelSubscription>>eventuallyConsistentMapBuilder()
            .withName("type_tunnel").withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    idGenerator = coreService.getIdGenerator(tunnelOpTopic);
    tunnelIdAsKeyStore.addListener(tunnelUpdateListener);
    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:18,
代码来源:DistributedTunnelStore.java

示例4: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    mcastRib = storageService.<McastRoute, MulticastData>consistentMapBuilder()
            .withName(MCASTRIB)
            .withSerializer(Serializer.using(KryoNamespace.newBuilder()
                                                     .register(KryoNamespaces.API)
                                                     .register(
                                                             AtomicReference.class,
                                                             MulticastData.class,
                                                             McastRoute.class,
                                                             McastRoute.Type.class
                                                     ).build()))
            //.withRelaxedReadConsistency()
            .build();
    mcastRib.addListener(mcastMapListener);
    mcastRoutes = mcastRib.asJavaMap();

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:20,
代码来源:DistributedMcastStore.java

示例5: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
protected void activate() {
    allocationMap = storageService.<HostId, IpAssignment>consistentMapBuilder()
            .withName("onos-dhcp-assignedIP")
            .withSerializer(Serializer.using(
                    new KryoNamespace.Builder()
                            .register(KryoNamespaces.API)
                            .register(IpAssignment.class,
                                    IpAssignment.AssignmentStatus.class,
                                    Date.class,
                                    long.class,
                                    Ip4Address.class)
                            .build()))
            .build();

    freeIPPool = storageService.<Ip4Address>setBuilder()
            .withName("onos-dhcp-freeIP")
            .withSerializer(Serializer.using(KryoNamespaces.API))
            .build()
            .asDistributedSet();

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:24,
代码来源:DistributedDhcpStore.java

示例6: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    appId = coreService.registerApplication(VTNRSC_APP);
    KryoNamespace.Builder serializer = KryoNamespace
            .newBuilder()
            .register(KryoNamespaces.API)
            .register(RouterId.class, TenantId.class, VirtualPortId.class,
                      RouterInterface.class, SubnetId.class);
    routerInterfaceStore = storageService
            .<SubnetId, RouterInterface>eventuallyConsistentMapBuilder()
            .withName(ROUTER_INTERFACE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    routerInterfaceStore.addListener(routerInterfaceListener);
    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:RouterInterfaceManager.java

示例7: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    appId = coreService.registerApplication(VTNRSC_APP);
    KryoNamespace.Builder serializer = KryoNamespace
            .newBuilder()
            .register(KryoNamespaces.API)
            .register(FloatingIp.class, FloatingIpId.class,
                      TenantNetworkId.class, TenantId.class,
                      FloatingIp.Status.class, RouterId.class,
                      VirtualPortId.class, DefaultFloatingIp.class,
                      UUID.class);
    floatingIpStore = storageService
            .<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
            .withName(FLOATINGIPSTORE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    floatingIpBindStore = storageService
            .<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
            .withName(FLOATINGIPBINDSTORE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    floatingIpStore.addListener(floatingIpListener);
    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:25,
代码来源:FloatingIpManager.java

示例8: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {

    eventDispatcher.addSink(PortChainEvent.class, listenerRegistry);

    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(PortChain.class, PortChainId.class, UUID.class, PortPairGroupId.class,
                      FlowClassifierId.class, FiveTuple.class, LoadBalanceId.class, DeviceId.class,
                      DefaultPortChain.class, PortPairId.class, TenantId.class);

    portChainStore = storageService
            .<PortChainId, PortChain>eventuallyConsistentMapBuilder()
            .withName("portchainstore").withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();

    portChainStore.addListener(portChainListener);

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:22,
代码来源:PortChainManager.java

示例9: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    eventDispatcher.addSink(PortPairGroupEvent.class, listenerRegistry);
    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(PortPairGroup.class, PortPairGroupId.class, UUID.class, DefaultPortPairGroup.class,
                      TenantId.class, PortPairId.class);

    portPairGroupStore = storageService
            .<PortPairGroupId, PortPairGroup>eventuallyConsistentMapBuilder()
            .withName("portpairgroupstore").withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();

    portPairGroupStore.addListener(portPairGroupListener);

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:PortPairGroupManager.java

示例10: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {

    eventDispatcher.addSink(PortPairEvent.class, listenerRegistry);
    KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(MultiValuedTimestamp.class)
            .register(PortPair.class, PortPairId.class, UUID.class, DefaultPortPair.class, TenantId.class);

    portPairStore = storageService.<PortPairId, PortPair>eventuallyConsistentMapBuilder()
            .withName("portpairstore")
            .withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();

    portPairStore.addListener(portPairListener);

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:20,
代码来源:PortPairManager.java

示例11: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    appId = coreService.registerApplication(VTNRSC_APP);
    KryoNamespace.Builder serializer = KryoNamespace
            .newBuilder()
            .register(KryoNamespaces.API)
            .register(Router.class, RouterId.class, DefaultRouter.class,
                      TenantNetworkId.class, TenantId.class,
                      VirtualPortId.class, DefaultRouter.class,
                      RouterGateway.class, Router.Status.class,
                      SubnetId.class, FixedIp.class);
    routerStore = storageService
            .<RouterId, Router>eventuallyConsistentMapBuilder()
            .withName(ROUTER).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    routerStore.addListener(routerListener);
    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:20,
代码来源:RouterManager.java

示例12: McastHandler

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
/**
 * Constructs the McastEventHandler.
 *
 * @param srManager Segment Routing manager
 */
public McastHandler(SegmentRoutingManager srManager) {
    coreAppId = srManager.coreService.getAppId(CoreService.CORE_APP_NAME);
    this.srManager = srManager;
    this.storageService = srManager.storageService;
    this.topologyService = srManager.topologyService;
    mcastKryo = new KryoNamespace.Builder()
            .register(KryoNamespaces.API)
            .register(McastStoreKey.class)
            .register(McastRole.class);
    mcastNextObjStore = storageService
            .<McastStoreKey, NextObjective>consistentMapBuilder()
            .withName("onos-mcast-nextobj-store")
            .withSerializer(Serializer.using(mcastKryo.build("McastHandler-NextObj")))
            .build();
    mcastRoleStore = storageService
            .<McastStoreKey, McastRole>consistentMapBuilder()
            .withName("onos-mcast-role-store")
            .withSerializer(Serializer.using(mcastKryo.build("McastHandler-Role")))
            .build();
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:26,
代码来源:McastHandler.java

示例13: createSerializer

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
private KryoNamespace.Builder createSerializer() {
    return new KryoNamespace.Builder()
            .register(KryoNamespaces.API)
            .register(NeighborSetNextObjectiveStoreKey.class,
                    SubnetNextObjectiveStoreKey.class,
                    SubnetAssignedVidStoreKey.class,
                    NeighborSet.class,
                    Tunnel.class,
                    DefaultTunnel.class,
                    Policy.class,
                    TunnelPolicy.class,
                    Policy.Type.class,
                    PortNextObjectiveStoreKey.class,
                    XConnectStoreKey.class
            );
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:17,
代码来源:SegmentRoutingManager.java

示例14: using

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
/**
 * Creates a new Serializer instance from a list of KryoNamespaces and some additional classes.
 *
 * @param namespaces kryo namespaces
 * @param classes variable length array of classes to register
 * @return Serializer instance
 */
static Serializer using(List<KryoNamespace> namespaces, Class<?>... classes) {
    KryoNamespace.Builder builder = new KryoNamespace.Builder();
    namespaces.forEach(builder::register);
    Lists.newArrayList(classes).forEach(builder::register);
    KryoNamespace namespace = builder.build();
    return new Serializer() {
        @Override
        public <T> byte[] encode(T object) {
            return namespace.serialize(object);
        }

        @Override
        public <T> T decode(byte[] bytes) {
            return namespace.deserialize(bytes);
        }
    };
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:25,
代码来源:Serializer.java

示例15: testKryoSerializable

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Test
public final void testKryoSerializable() {
    WallClockTimestamp ts1 = new WallClockTimestamp();
    WallClockTimestamp ts2 = new WallClockTimestamp(System.currentTimeMillis() + 10000);
    final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
    final KryoNamespace kryos = KryoNamespace.newBuilder()
            .register(WallClockTimestamp.class)
            .build();

    kryos.serialize(ts1, buffer);
    buffer.flip();
    Timestamp copy = kryos.deserialize(buffer);

    new EqualsTester()
            .addEqualityGroup(ts1, copy)
            .addEqualityGroup(ts2)
            .testEquals();
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:WallClockTimestampTest.java

示例16: createSerializer

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
private StoreSerializer createSerializer(KryoNamespace ns) {
    return StoreSerializer.using(KryoNamespace.newBuilder()
                     .register(ns)
                     // not so robust way to avoid collision with other
                     // user supplied registrations
                     .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID + 100)
                     .register(KryoNamespaces.BASIC)
                     .register(LogicalTimestamp.class)
                     .register(WallClockTimestamp.class)
                     .register(AntiEntropyAdvertisement.class)
                     .register(AntiEntropyResponse.class)
                     .register(UpdateEntry.class)
                     .register(MapValue.class)
                     .register(MapValue.Digest.class)
                     .register(UpdateRequest.class)
                     .build(name() + "-ecmap"));
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:18,
代码来源:EventuallyConsistentMapImpl.java

示例17: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    tpool = Executors.newFixedThreadPool(4, groupedThreads("onos/flobj-notifier", "%d", log));
    eventQ = new LinkedBlockingQueue<ObjectiveEvent>();
    tpool.execute(new FlowObjectiveNotifier());
    nextGroups = storageService.<Integer, byte[]>consistentMapBuilder()
            .withName("flowobjective-groups")
            .withSerializer(Serializer.using(
                    new KryoNamespace.Builder()
                            .register(byte[].class)
                            .register(Versioned.class)
                            .build("DistributedFlowObjectiveStore")))
            .build();
    nextGroups.addListener(mapListener);
    nextIds = storageService.getAtomicCounter("next-objective-counter");
    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:18,
代码来源:DistributedFlowObjectiveStore.java

示例18: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    KryoNamespace.Builder hostSerializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API);

    hostsConsistentMap = storageService.<HostId, DefaultHost>consistentMapBuilder()
            .withName("onos-hosts")
            .withRelaxedReadConsistency()
            .withSerializer(Serializer.using(hostSerializer.build()))
            .build();

    hosts = hostsConsistentMap.asJavaMap();

    prevHosts.putAll(hosts);

    hostsConsistentMap.addListener(hostLocationTracker);

    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:20,
代码来源:DistributedHostStore.java

示例19: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
public void activate() {
    KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder()
            .register(KryoNamespaces.API)
            .register(ConfigKey.class, ObjectNode.class, ArrayNode.class,
                      JsonNodeFactory.class, LinkedHashMap.class,
                      TextNode.class, BooleanNode.class,
                      LongNode.class, DoubleNode.class, ShortNode.class, IntNode.class,
                      NullNode.class);

    configs = storageService.<ConfigKey, JsonNode>consistentMapBuilder()
            .withSerializer(Serializer.using(kryoBuilder.build()))
            .withName("onos-network-configs")
            .withRelaxedReadConsistency()
            .build();
    configs.addListener(listener);
    log.info("Started");
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:19,
代码来源:DistributedNetworkConfigStore.java

示例20: testKryoSerializable

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Test
public final void testKryoSerializable() {
    final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
    final KryoNamespace kryos = KryoNamespace.newBuilder()
            .register(Timestamped.class,
                    MastershipBasedTimestamp.class)
            .build();

    Timestamped<String> original = new Timestamped<>("foobar", TS_1_1);
    kryos.serialize(original, buffer);
    buffer.flip();
    Timestamped<String> copy = kryos.deserialize(buffer);

    new EqualsTester()
        .addEqualityGroup(original, copy)
        .testEquals();
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:18,
代码来源:TimestampedTest.java

示例21: setupKryoPool

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Override
protected void setupKryoPool() {
    serializerPool = KryoNamespace.newBuilder()
            .register(DistributedStoreSerializers.STORE_COMMON)
            .nextId(DistributedStoreSerializers.STORE_CUSTOM_BEGIN)
            .register(new InternalDeviceEventSerializer(), InternalDeviceEvent.class)
            .register(new InternalDeviceOfflineEventSerializer(), InternalDeviceOfflineEvent.class)
            .register(InternalDeviceRemovedEvent.class)
            .register(new InternalPortEventSerializer(), InternalPortEvent.class)
            .register(new InternalPortStatusEventSerializer(), InternalPortStatusEvent.class)
            .register(DeviceAntiEntropyAdvertisement.class)
            .register(DeviceFragmentId.class)
            .register(PortFragmentId.class)
            .register(DeviceInjectedEvent.class)
            .register(PortInjectedEvent.class)
            .build();
}
 

开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:18,
代码来源:GossipDeviceStore.java

示例22: PacketRequestTracker

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
public PacketRequestTracker() {
    requests = storageService.<PacketRequest, Boolean>consistentMapBuilder()
            .withName("packet-requests")
            .withSerializer(new Serializer() {
                KryoNamespace kryo = new KryoNamespace.Builder()
                        .register(KryoNamespaces.API)
                        .build();
                @Override
                public <T> byte[] encode(T object) {
                    return kryo.serialize(object);
                }

                @Override
                public <T> T decode(byte[] bytes) {
                    return kryo.deserialize(bytes);
                }
            }).build();
}
 

开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:19,
代码来源:DistributedPacketStore.java

示例23: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Override
@Activate
public void activate() {
    super.activate();

    this.serializer = new KryoSerializer() {
        @Override
        protected void setupKryoPool() {
            serializerPool = KryoNamespace.newBuilder()
                    .register(KryoNamespaces.API)
                    .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID)
                    .build();
        }
    };

    lastAppId = theInstance.getAtomicLong("applicationId");

    appIdsByName = new SMap<>(theInstance.<byte[], byte[]>getMap("appIdsByName"), this.serializer);
    listenerId = appIdsByName.addEntryListener((new RemoteAppIdEventHandler()), true);

    primeAppIds();

    log.info("Started");
}
 

开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:25,
代码来源:DistributedApplicationIdStore.java

示例24: createSerializer

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
private KryoSerializer createSerializer(KryoNamespace.Builder builder) {
    return new KryoSerializer() {
        @Override
        protected void setupKryoPool() {
            // Add the map's internal helper classes to the user-supplied serializer
            serializerPool = builder
                    .register(LogicalTimestamp.class)
                    .register(WallClockTimestamp.class)
                    .register(PutEntry.class)
                    .register(RemoveEntry.class)
                    .register(ArrayList.class)
                    .register(AntiEntropyAdvertisement.class)
                    .register(HashMap.class)
                    .register(Timestamped.class)
                    .build();
        }
    };
}
 

开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:19,
代码来源:EventuallyConsistentMapImpl.java

示例25: testKryoSerializable

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Test
public final void testKryoSerializable() {
    WallClockTimestamp ts1 = new WallClockTimestamp();
    final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
    final KryoNamespace kryos = KryoNamespace.newBuilder()
            .register(WallClockTimestamp.class)
            .build();

    kryos.serialize(ts1, buffer);
    buffer.flip();
    Timestamp copy = kryos.deserialize(buffer);

    new EqualsTester()
        .addEqualityGroup(ts1, copy)
        .testEquals();
}
 

开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:17,
代码来源:WallClockTimestampTest.java

示例26: setupKryoPool

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Override
protected void setupKryoPool() {
    serializerPool = KryoNamespace.newBuilder()
            // Classes we give to the map
            .register(KryoNamespaces.API)
            .register(TestTimestamp.class)
            // Below is the classes that the map internally registers
            .register(LogicalTimestamp.class)
            .register(WallClockTimestamp.class)
            .register(PutEntry.class)
            .register(RemoveEntry.class)
            .register(ArrayList.class)
            .register(AntiEntropyAdvertisement.class)
            .register(HashMap.class)
            .build();
}
 

开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:17,
代码来源:EventuallyConsistentMapImplTest.java

示例27: setup

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Before
public void setup() {
    // Init step
    meterStore = new DistributedMeterStore();
    // Let's initialize some internal services
    TestUtils.setField(meterStore, "storageService", new TestStorageService());
    TestUtils.setField(meterStore, "clusterService", new TestClusterService());
    TestUtils.setField(meterStore, "mastershipService", new TestMastershipService());
    TestUtils.setField(meterStore, "driverService", new TestDriverService());

    // Inject TestApplicationId into the DistributedMeterStore serializer
    KryoNamespace.Builder testKryoBuilder = TestUtils.getField(meterStore, "APP_KRYO_BUILDER");
    testKryoBuilder.register(TestApplicationId.class);
    Serializer testSerializer = Serializer.using(Lists.newArrayList(testKryoBuilder.build()));
    TestUtils.setField(meterStore, "serializer", testSerializer);

    // Activate the store
    meterStore.activate();
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:20,
代码来源:DistributedMeterStoreTest.java

示例28: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
/**
 * Sets up distributed route store.
 */
public void activate() {
    routeTables = new ConcurrentHashMap<>();
    executor = Executors.newSingleThreadExecutor(groupedThreads("onos/route", "store", log));

    KryoNamespace masterRouteTableSerializer = KryoNamespace.newBuilder()
            .register(RouteTableId.class)
            .build();

    masterRouteTable = storageService.<RouteTableId>setBuilder()
            .withName("onos-master-route-table")
            .withSerializer(Serializer.using(masterRouteTableSerializer))
            .build()
            .asDistributedSet();

    masterRouteTable.addListener(masterRouteTableListener);

    // Add default tables (add is idempotent)
    masterRouteTable.add(IPV4);
    masterRouteTable.add(IPV6);

    masterRouteTable.forEach(this::createRouteTable);

    log.info("Started");
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:28,
代码来源:DistributedRouteStore.java

示例29: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
protected void activate(ComponentContext context) {
    componentConfigService.preSetProperty(
            "org.onosproject.incubator.store.routing.impl.RouteStoreImpl",
            "distributed", "true");

    componentConfigService.registerProperties(getClass());

    KryoNamespace serializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(FpmPeer.class)
            .register(FpmConnectionInfo.class)
            .build();
    peers = storageService.<FpmPeer, Set<FpmConnectionInfo>>consistentMapBuilder()
            .withName("fpm-connections")
            .withSerializer(Serializer.using(serializer))
            .build();

    modified(context);
    startServer();

    appId = coreService.registerApplication(APP_NAME, peers::destroy);

    log.info("Started");
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:26,
代码来源:FpmManager.java

示例30: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
@Activate
protected void activate() {
    allocationMap = storageService.<HostId, IpAssignment>consistentMapBuilder()
            .withName("onos-dhcp-assignedIP")
            .withSerializer(Serializer.using(
                    new KryoNamespace.Builder()
                            .register(KryoNamespaces.API)
                            .register(IpAssignment.class,
                                    IpAssignment.AssignmentStatus.class,
                                    Date.class)
                            .build("dhcp")))
            .build();

    freeIPPool = storageService.<Ip4Address>setBuilder()
            .withName("onos-dhcp-freeIP")
            .withSerializer(Serializer.using(KryoNamespaces.API))
            .build()
            .asDistributedSet();

    log.info("Started");
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:22,
代码来源:DistributedDhcpStore.java

示例31: buildRouteMap

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
private ConsistentMap<EvpnPrefix, Set<EvpnRoute>> buildRouteMap(StorageService
                                                                        storageService) {
    KryoNamespace routeTableSerializer = KryoNamespace.newBuilder()
            .register(KryoNamespaces.API)
            .register(KryoNamespaces.MISC)
            .register(EvpnRoute.class)
            .register(EvpnPrefix.class)
            .register(RouteDistinguisher.class)
            .register(MacAddress.class)
            .register(IpPrefix.class)
            .register(EvpnRoute.Source.class)
            .register(IpAddress.class)
            .register(VpnRouteTarget.class)
            .register(Label.class)
            .register(EvpnRouteTableId.class)
            .build();
    return storageService.<EvpnPrefix, Set<EvpnRoute>>consistentMapBuilder()
            .withName("onos-evpn-routes-" + id.name())
            .withRelaxedReadConsistency()
            .withSerializer(Serializer.using(routeTableSerializer))
            .build();
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:23,
代码来源:EvpnRouteTable.java

示例32: activate

点赞 3

import org.onlab.util.KryoNamespace; //导入依赖的package包/类
/**
 * Sets up distributed route store.
 */
@Activate
public void activate() {
    routeTables = new ConcurrentHashMap<>();
    executor = Executors.newSingleThreadExecutor(groupedThreads("onos/route", "store", log));

    KryoNamespace masterRouteTableSerializer = KryoNamespace.newBuilder()
            .register(EvpnRouteTableId.class)
            .build();

    masterRouteTable = storageService.<EvpnRouteTableId>setBuilder()
            .withName("onos-master-route-table")
            .withSerializer(Serializer.using(masterRouteTableSerializer))
            .build()
            .asDistributedSet();

    masterRouteTable.forEach(this::createRouteTable);

    masterRouteTable.addListener(masterRouteTableListener);

    // Add default tables (add is idempotent)
    masterRouteTable.add(EVPN_IPV4);
    masterRouteTable.add(EVPN_IPV6);

    log.info("Started");
}
 

开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:29,
代码来源:DistributedEvpnRouteStore.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)