zoukankan      html  css  js  c++  java
  • Floodlight之 FloodlightContextStore 数据结构

         FloodlightContextStore 代表的是一种缓存模型(利用的是ConcurrentHashMap)。里面存储的是上下文相关的对象,可以依据对应的key得到详细的 Object。存在的意义是Floodlight中注冊监听某个事件的listener可以在被调用的时候直接从中取出上下文信息(context information)。以下是重要的代码片段.

    基本数据结构:
    public class FloodlightContext {
        protected ConcurrentHashMap<String, Object> storage =
                new ConcurrentHashMap<String, Object>();

        public ConcurrentHashMap<String, Object> getStorage() {
            return storage ;
        }
    }
    -----------
    public class FloodlightContextStore<V> {
       
        @SuppressWarnings( "unchecked" )
        public V get(FloodlightContext bc, String key) {
            return (V)bc.storage .get(key);
        }
       
        public void put(FloodlightContext bc, String key, V value) {
            bc. storage.put(key, value);
        }
       
        public void remove(FloodlightContext bc, String key) {
            bc. storage.remove(key);
        }
    }

    使用场景:
    if (eth != null ) {
       IFloodlightProviderService.bcStore.put(bc,IFloodlightProviderService.CONTEXT_PI_PAYLOAD,     eth);
    }

    当中。核心接口 IFloodlightProviderService(以下是类层次图) 是Floodlight controller 和 openflow SW交互的部分,当中的成员 bcStore 存储的是解析后的packet in代表的ethenet实例,所以其它监听packet in的listeners能够直接取出,进行处理。











  • 相关阅读:
    python自定义排序
    flex 布局
    display: table-cell; 元素上下左右居中,子元素无宽高
    transform 方法 上下左右元素居中 子元素无宽高
    flex 方法上下左右居中 子元素无宽高
    兼容-02
    兼容
    jS辨别访问浏览器判断是android还是ios系统
    选项卡
    返回顶部
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/5183050.html
Copyright © 2011-2022 走看看