講到 DAC, 最先浮現腦海的一定是 digital analog converter. 然而, 偏偏就是有人喜歡把自己的東西命名為更慣用的名詞, 藉以拉抬知名度. 此處的 DAC 是指 downloadable application container. 也就是可下載的 container.
關鍵字 container 的宗旨在於把應用程式封裝在一個容器中, 於是它幾乎不受外在環境設定的影響. 比方說 docker [2]. 當然徒 container 不足以自行, 先要 porting 好一個內應, 也就是 docker engine. 接著才能承上啟下.
至於 DAC 則是 Comcast, Sky, Liberty Global, Metrological (已併入 Comcast) and Consult Red 所開發的一套 container 系統. 除了 Consult Red 是僅存的軟體服務公司, 其他都變成運營商了 – 也就是對應台灣的凱擘, 中華電信. 下圖右上角這塊 app store 的雲端, 左上角是 APP SDK, 下方是接受 APP 的 device, 像是 STB, 或者電信業名詞叫 CPE.
下載的 APP 為何能動? 在這裡的共通介面就是 OCI (Open Container Initiative ) [3]. 一套 OCI Image 被下載時, 會在雲端被打包為 OCI bundle. 通常只是壓縮, 但也可以被加密. Pull 到 CPE 後由 DAC installer (packager) 打包成 OCIContainer.
OCI 中除了 OCI Image 外, 另外一個角色是 OCI runtime. 它的用途在於安裝 container 到特定 file system 上, 它也放在 OCI bundle 的裡面. 實做方式有 Crun 和 Runc 兩種. 看官您覺得這命名鬧不鬧? 兩種方式各有支持者, Runc 是 RDK 聯盟採用的版本, 優點是體積小.
OCI define both a runtime specification and an image specification. The Runtime Specification outlines how to run a “filesystem bundle” that is unpacked on disk. The OCI image is used for packaging containers in a platform-agnostic way that can be easily distributed. At a high-level, an OCI implementation would download an OCI Image then unpack that image into an OCI Runtime filesystem bundle. At this point the OCI Runtime Bundle would be run by an OCI Runtime.
當然在 RDK 環境, APP 還是會由 RDK shell 控管. RDK shell 也管第一章流程圖左邊的 thunder container, 但這不在主題中先跳過. 其他還沒解釋到的剩下 Dobby [4].
Dobby 是哈利波特裡面的家庭小精靈. Well,.. RDK 聯盟的人有一票是冰與火之歌的劇迷, 所以新技術的名字都取自劇中的大陸, 例如 Westeros, ESSOS, …etc. 幸好 Dobby 是 Sky 的技術, 英國人當然要支援國貨.
Dobby 不是 container, 而是 container management 的 daemon. 它用來管理 container 的 lifecycle (start, stop, …etc.), 它的附加功能 (plugins) 還包括這些:
- Advanced container networking support with NAT and both IPv4 and IPv6 support. Allows for easily adding iptables rules to allow/prevent traffic flow in and out of container
- GPU memory limiting (providing the kernel has the appropriate support)
- Container log management to either files or directly to journald
- Loopback storage mounts to add persistent, isolated storage to containers
- IPC support between containers/host by allowing access to the host dbus inside containers
[Note]