Search in sources :

Example 16 with StorageService

use of org.onosproject.store.service.StorageService in project onos by opennetworkinglab.

the class DistributedDhcpRelayStore method activated.

@Activate
protected void activated() {
    dhcpRecords = storageService.<HostId, DhcpRecord>eventuallyConsistentMapBuilder().withName("DHCP-Relay-Records").withTimestampProvider((hostId, record) -> {
        if (record != null) {
            return new WallClockTimestamp(record.lastSeen());
        } else {
            return new WallClockTimestamp();
        }
    }).withSerializer(APP_KRYO).build();
    listener = new InternalMapListener();
    dhcpRecords.addListener(listener);
}
Also used : Logger(org.slf4j.Logger) EventuallyConsistentMapEvent(org.onosproject.store.service.EventuallyConsistentMapEvent) Deactivate(org.osgi.service.component.annotations.Deactivate) Collection(java.util.Collection) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) KryoNamespace(org.onlab.util.KryoNamespace) StoreDelegate(org.onosproject.store.StoreDelegate) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) DHCP6(org.onlab.packet.DHCP6) Component(org.osgi.service.component.annotations.Component) StorageService(org.onosproject.store.service.StorageService) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) Optional(java.util.Optional) Activate(org.osgi.service.component.annotations.Activate) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) EventuallyConsistentMap(org.onosproject.store.service.EventuallyConsistentMap) DHCP(org.onlab.packet.DHCP) EventuallyConsistentMapListener(org.onosproject.store.service.EventuallyConsistentMapListener) Reference(org.osgi.service.component.annotations.Reference) HostId(org.onosproject.net.HostId) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

StorageService (org.onosproject.store.service.StorageService)16 Activate (org.osgi.service.component.annotations.Activate)4 Component (org.osgi.service.component.annotations.Component)4 Deactivate (org.osgi.service.component.annotations.Deactivate)4 Reference (org.osgi.service.component.annotations.Reference)4 ReferenceCardinality (org.osgi.service.component.annotations.ReferenceCardinality)4 Logger (org.slf4j.Logger)4 Collection (java.util.Collection)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 KryoNamespace (org.onlab.util.KryoNamespace)3 ClusterService (org.onosproject.cluster.ClusterService)3 KryoNamespaces (org.onosproject.store.serializers.KryoNamespaces)3 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)2 ImmutableList (com.google.common.collect.ImmutableList)2 Dictionary (java.util.Dictionary)2 Map (java.util.Map)2 Objects (java.util.Objects)2 ComponentConfigService (org.onosproject.cfg.ComponentConfigService)2 NodeId (org.onosproject.cluster.NodeId)2