postgresql.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:parsec-cloud 作者: Scille 项目源码 文件源码
def perform_vlob_read(self, intent):
        async with self.connection.acquire() as conn:
            async with conn.cursor() as cur:
                if intent.version:
                    await cur.execute("SELECT * FROM vlobs WHERE "
                                      "id=%s AND version=%s;", (intent.id, intent.version))
                else:
                    await cur.execute("SELECT * FROM vlobs WHERE "
                                      "id=%s ORDER BY version DESC;", (intent.id, ))
                ret = await cur.fetchone()
        if not ret:
            raise VlobNotFound('Vlob not found.')
        _, version, rts, wts, blob = ret
        if rts != intent.trust_seed:
            raise TrustSeedError('Invalid read trust seed.')
        return VlobAtom(id=intent.id, version=version, read_trust_seed=rts,
                        write_trust_seed=wts, blob=bytes(blob))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号