另一个开源IM全功能客户端Spark就是基于此库编写的,微信移动端数据库组件WCDB即将开源

摘要Smack是著名的开源XMPP客户端库,另一个开源IM全功能客户端Spark就是基于此库编写的,2017年6月7日Smack正式发由了4.2.1版。前言Smack是著名的开源XMPP客户端库,另一个开源IM全功能客户端Spark就是基于此库编写的(Spark或其修改版被众多国内中小企业作为内部沟通工具),2016年4月15日Smack正式发由了4.1.7版,此版为小幅更新版。更新内容详见官方博客:

摘要Smack是著名的开源XMPP客户端库,另一个开源IM全功能客户端Spark就是基于此库编写的,2017年3月20日Smack正式发由了4.2.0版。前言Smack是著名的开源XMPP客户端库,另一个开源IM全功能客户端Spark就是基于此库编写的(Spark或其修改版被众多国内中小企业作为内部沟通工具),2017年3月21日Smack正式发布了4.2.0版,此版为主要更新版。更新内容Sub-task[SMACK-639]

摘要微信开发团队宣布将微信自用的移动端数据库组件 WCDB(WeChat
Database)正式对外开源。前言微信团队两周前预告即将开源WCDB后(详见当时资讯《[资讯]
微信移动端数据库组件WCDB即将开源!》),于2017年06月09日正式开源了微信自用的移动端数据库组件
WCDB(WeChat
Database)。WCDB简介WCDB是一个高效、完整、易用的移动数据库框架,基于
SQLCipher,支持 iOS、macOS 和
Android。微信高级工程师何俊伟表示:“开源只是故事的开始,我们仍会持续对
WCDB
做改进,包括更易用的接口、更好的性能、更高的可靠性。这些改进最终也会原封不动地在微信使用。”WCDB(WeChatDataBase)是微信官方的移动端数据库组件,致力于提供一个高效、易用、完整的移动端存储方案。它包含三个模块:WCDB-iOS/Mac;WCDB-Android;数据库损坏修复工具WCDBRepair。WCDB的开发背景对于iOS开发者来说,数据库的技术选型一直是个令人头痛的问题。由于Apple提供的CoreData框架差强人意,使得开发者们纷纷将目光投向开源社区,寻找更好的存储方案。
对于微信也是如此。数据库是微信内最基础的组件之一,消息收发、联系人、朋友圈等等业务都离不开数据库的支持。为了满足需求,我们也对现有方案做了对比研究。目前移动端数据库方案按其实现可分为两类:关系型数据库,代表有CoreData、FMDB等。CoreData
它是苹果内建框架,和Xcode深度结合,可以很方便进行ORM;但其上手学习成本较高,不容易掌握。稳定性也堪忧,很容易crash;多线程的支持也比较鸡肋。FMDB
它基于SQLite封装,对于有SQLite和ObjC基础的开发者来说,简单易懂,可以直接上手;而缺点也正是在此,FMDB只是将SQLite的C接口封装成了ObjC接口,没有做太多别的优化,即所谓的胶水代码(Glue

  • Add support for pre-approved subscription requests (RFC 6121 §
    3.4)Bug[SMACK-306] – loadRosterOnLogin has non-trivial side effect on
    getRoster[SMACK-416] – Refactor PEP to make it use the existing pubsub
    API.[SMACK-674] – PubSub Affiliation extension element is missing
    ‘jid’ attribute, and is using wrong element name
    ‘subscription'[SMACK-682] – Add support for “XEP-0360: Nonzas (are not
    Stanzas)”[SMACK-683] – Using a Proxy with XMPPTCPConnection failes
    with “SocketException: Unconnected sockets not implemented”[SMACK-691]
  • Add support for MUCItem’s Actor ‘nick'[SMACK-705] – PubSub’s
    Affiliation.getElementName() returns wrong name[SMACK-722] – SASL
    X-OAUTH2 implementation incorrectly performs Base64 encoding
    twice[SMACK-723] – Support “Caps Optimizations” (XEP-0115 §
    8.4)[SMACK-724] – Do not re-use the Socket after connect()
    failed.[SMACK-725] – ReconnectionManager should handle
    AlreadyConnectedException and AlreadyLoggedInException not as
    failure[SMACK-741] – Ad-hoc command ‘note’ element ‘type’ attribute
    should be treated as optional[SMACK-745] – Memory leak in
    MultiUserChatNew Feature[SMACK-366] – Add support for
    DNSSEC.[SMACK-610] – Add support for XEP-0080: User
    Location[SMACK-619] – Add roomDestroyed to MUC
    UserStatusListener[SMACK-625] – Add support for XEP-313: Message
    Archive Management[SMACK-675] – Add support for PubSub affiliation
    actions as owner[SMACK-677] – Add support for SASL ‘authzid’
    (Authorization Identity)[SMACK-690] – Add support for DNS-Based
    Authentication of Named Entities (DANE, RFC 6698)[SMACK-731] – Add
    support for XEP-0191: Blocking Command[SMACK-732] – Smack should be
    able to handle “single equals sign” SASL responses[SMACK-740] – Add
    support for Multi-User Chat Light[SMACK-742] – Add support for
    XEP-0133: Service Administration[SMACK-747] – Add support for
    XEP-0363: HTTP File UploadTask[SMACK-638] – Call connection creation
    listeners from within AbstractXMPPConnection’s constructor[SMACK-644]
  • Throw exception if account creation or password change is performed
    over insecure connections[SMACK-655] – Enable StreamManagement by
    defaultImprovement[SMACK-372] – Make package protected methods in
    PEPItem public[SMACK-572] – Rejoin MUC rooms after
    reconnect[SMACK-628] – Rework Roster handling with anonymous
    connections[SMACK-629] – Rework how Smack handles anonymous
    connections[SMACK-631] – Improve ParsingExceptionCallback, allow it to
    be a functional interface[SMACK-632] – Make Smack
    interruptible[SMACK-633] – Allow clean and graceful disconnects
    (stream closing)[SMACK-634] – Use jxmpp-jid, add Jid class to replace
    String’s being used as JIDs[SMACK-646] – Add support for MUC roomnick
    rewrite[SMACK-647] – Don’t automatically call login() on connect() if
    the connection was authenticated before[SMACK-648] – Improve
    MultiUserChat API[SMACK-657] – Rename RosterEntry.getStatus and
    RosterPacket.ItemStatus to ItemAskStatus[SMACK-663] – Roster should be
    fully loaded when Roster.getInstanceFor(XMPPConnection) is called with a
    authenticated connection[SMACK-665] – Rename ‘serviceName’ to
    ‘xmppServiceDomain'[SMACK-666] – Typo in
    ‘RosterEntries.rosterEntires()’, change to
    ‘RosterEntries.rosterEntries()'[SMACK-703] – Limit the stored
    presences of entities not in Roster[SMACK-704] – Pass down Message
    stanza in ChatStateListener[SMACK-711] – Improve the logging of TCP
    connection attempts.[SMACK-720] – Improve support for Tor and Hidden
    Services.[SMACK-721] – Report illegal Stream Management states to
    avoid OOM Exception[SMACK-727] – Add partial support for the IoT XEPs
    (XEP-0323, -0324, -0325, -0347)[SMACK-733] – Handle outgoing
    ‘unavailable’ Presences in Roster[SMACK-736] – Add support for Chat
    Markers (XEP-0333)[SMACK-737] – Add support for Bits of Binary
    (XEP-0231)[SMACK-738] – Add support for Push Notifications
    (XEP-0357)下载地址下载地址点此进入:

Code)。使用过程需要用大量的代码拼接SQL、拼装Object,并不方便。key-value数据库,代表有Realm、LevelDB、RocksDB等。Realm因其在各平台封装、优化的优势,比较受移动开发者的欢迎。对于iOS开发者,key-value的实现直接易懂,可以像使用NSDictionary一样使用Realm。并且ORM彻底,省去了拼装Object的过程。但其对代码侵入性很强,Realm要求类继承RLMObject的基类。这对于单继承的ObjC,意味着不能再继承其他自定义的子类。同时,key-value数据库对较为复杂的查询场景也比较无力。可见,各个方案都有其独特的优势及劣势,没有最好的,只有最适合的。而对于微信来说,我们所期望的数据库应满足:高效;增删改查的高效是数据库最基本的要求。除此之外,我们还希望能够支持多个线程高并发地操作数据库,以应对微信频繁收发消息的场景。易用;这是微信开源的原则,也是WCDB的原则。SQLite本不是一个易用的组件:为了完成一个查询,往往我们需要写很多拼接字符串、组装Object的胶水代码。这些代码冗长繁杂,而且容易出错,我们希望组件能统一完成这些任务。完整;数据库操作是一个复杂的场景,我们希望数据库组件能完整覆盖各种场景。包括数据库损坏、监控统计、复杂的查询、反注入等。显然,上述各个方案都不能完全满足微信的需求。于是,我们造了这个“轮子”

WCDB-iOS/Mac。WCDB通过ORM和WINQ,体现了其易用性上的优势,使得数据库操作不再繁杂。同时,通过链式调用,开发者也能够方便地获取数据库操作的耗时等性能信息。而高级用法则扩展了WCDB的功能和用法。详情请见:《微信移动端数据库组件WCDB系列(一)-iOS基础篇》WCDB源码下载WCDB源码托管地址:

相关文章