use of org.onosproject.mapping.StoredMappingEntry in project onos by opennetworkinglab.
the class SimpleMappingStore method storeMapping.
@Override
public void storeMapping(Type type, MappingEntry mapping) {
List<StoredMappingEntry> entries = getMappingEntriesInternal(type, mapping.deviceId(), mapping.id());
synchronized (entries) {
if (!entries.contains(mapping)) {
StoredMappingEntry entry = new DefaultMappingEntry(mapping, mapping.state());
entries.add(entry);
}
}
}
use of org.onosproject.mapping.StoredMappingEntry in project onos by opennetworkinglab.
the class SimpleMappingStore method addOrUpdateMappingEntry.
@Override
public MappingEvent addOrUpdateMappingEntry(Type type, MappingEntry entry) {
List<StoredMappingEntry> entries = getMappingEntriesInternal(type, entry.deviceId(), entry.id());
synchronized (entries) {
for (StoredMappingEntry stored : entries) {
if (stored.equals(entry)) {
if (stored.state() == PENDING_ADD) {
stored.setState(MappingEntryState.ADDED);
return new MappingEvent(MAPPING_ADDED, entry);
}
return new MappingEvent(MAPPING_UPDATED, entry);
}
}
}
log.error("Mapping was not found in store {} to update", entry);
return null;
}
Aggregations