Paxos in One Picture

摘要: If Accepted(N, quorum) happens, Prepared(N, quorum) always happens (right) before it. If Prepared(N, quorum) happens, it always happens before any Prepared(M, quorum) where N < M. If Accepted(N, quorum) happens, it always happens before any Prepared(M, quorum) where N < M.阅读全文
posted @ 2017-12-26 02:44 Todd Wei 阅读(66) 评论(0) 编辑

Understanding Product and Sum in Category Theory

摘要: Product type guarantees that if you have a function of type Y -> X1 and a function of type Y -> X2, you must have a unique function of type Y -> X1 x X2 satisfying the property. Sum type guarantees that if you have a unique function of type X1 -> Y and a function of type X2 -> Y, you must have a function of type X1 ∐ X2 -> Y satisfying the property.阅读全文
posted @ 2017-12-04 07:32 Todd Wei 阅读(46) 评论(0) 编辑

Converting Recursive Traversal to Iterator

摘要: Introduces a general pattern named Lazy Iterator for converting recursive traversal to iterator. It can be used to simulate generator (the "yield" keyword) in languages like Python.阅读全文
posted @ 2017-11-13 12:31 Todd Wei 阅读(168) 评论(0) 编辑

Monad Explained in One Picture

摘要: The point of Monad is composability. In the green category, T -> Monad and U -> Monad阅读全文
posted @ 2017-05-05 13:00 Todd Wei 阅读(410) 评论(0) 编辑

Stateful Future Transformation

摘要: A general function to transform the future of an initial state to the future of its final state.阅读全文
posted @ 2017-03-13 03:11 Todd Wei 阅读(278) 评论(0) 编辑

Function Composition vs Object Composition

摘要: Functions are born in a harmonious ecosystem. Whenever you write a function, you automatically enjoy compose, functors, monads, monad transformers...阅读全文
posted @ 2017-02-06 14:55 Todd Wei 阅读(343) 评论(0) 编辑

Distributed MVCC Based Cross-row Transaction

摘要: The algorithm for supporting distributed MVCC based multi-row transactions on top of a distributed key-value database with single-row transaction support.阅读全文
posted @ 2016-11-28 15:30 Todd Wei 阅读(271) 评论(0) 编辑

A Beginner's Guide to Paxos

摘要: The core ideas of Paxos protocol: 1) Optimistic concurrency control (variant 2). Hold a "preemptible lock" first, try updating, restart on denial; 2) Quorum as a logical unit of acceptor for choose operation. A value is chosen iff it's accepted by a quorum, which implies from the proposer's perspective the choose operation is atomic, it's all or nothing, it's either accepted by a quorum or it isn't.阅读全文
posted @ 2016-07-07 14:33 Todd Wei 阅读(640) 评论(1) 编辑

Functional Programming without Lambda - Part 2 Lifting, Functor, Monad

摘要: fmap :: (T -> R) -> Functor<T> -> Functor<R> lifts a function of type T -> R into a function of type Functor<T> -> Functor<R>; flatMap :: (T -> Monad<R>) -> Monad<T> -> Monad<R> lifts a function of type T -> Monad<R> into a function of type Monad<T> -> Monad<R>.阅读全文
posted @ 2015-05-30 12:47 Todd Wei 阅读(1390) 评论(0) 编辑

Functional Programming without Lambda - Part 1 Functional Composition

摘要: Functional programming doesn't necessarily depend on Lambda, it's more about the unique way of composing a bunch a small functions into a larger one.阅读全文
posted @ 2015-05-25 13:35 Todd Wei 阅读(1477) 评论(0) 编辑

公告

统计

  • 随笔 - 64
  • 文章 - 43
  • 评论 - 1164