Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add onFailure to EnrichedMergeableStore #200

Merged
merged 4 commits into from
Jan 13, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,12 @@ class EnrichedMergeableStore[K, V](store: MergeableStore[K, V]) {

def convert[K1, V1](fn: K1 => K)(implicit bij: ImplicitBijection[V1, V]): MergeableStore[K1, V1] =
MergeableStore.convert(store)(fn)

def onMergeFailure(rescueException: Throwable => Unit): MergeableStore[K, V] =
new MergeableStoreProxy[K, V] {
override def self = store
override def merge(kv: (K, V)) = store.merge(kv).onFailure(rescueException)
override def multiMerge[K1 <: K](kvs: Map[K1, V]) =
store.multiMerge(kvs).mapValues { _.onFailure(rescueException) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapValues is lazy. This is not being applied if any keys are not accessed.

}
}