﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Daniel Lang commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Thanks for sharing this useful series. It was really interesting to see how such decisions are made up.</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment16</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment16</guid><pubDate>Tue, 05 Jun 2012 21:36:05 GMT</pubDate></item><item><title>Alex Beynenson commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>I like the option that the exception is thrown. To me that's way more elegant than a custom error handling delegate. If you squint just right, it pretty much looks like a try/catch block anyway.</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment15</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment15</guid><pubDate>Mon, 04 Jun 2012 15:30:56 GMT</pubDate></item><item><title>Ayende Rahien commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Andreas,
Note that you are free to implement local solutions, and you _can_ do that, quite easily.
You can give specific error messages, you can change behavior based on the current context, etc.
</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment14</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment14</guid><pubDate>Sat, 02 Jun 2012 10:57:10 GMT</pubDate></item><item><title>Ayende Rahien commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Lucas,
Then an exception is thrown.</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment13</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment13</guid><pubDate>Sat, 02 Jun 2012 10:56:13 GMT</pubDate></item><item><title>Lucas Ontivero commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Question: what if the developer doesn´t provide an error handler? Will he gets an exception? </description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment11</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment11</guid><pubDate>Sat, 02 Jun 2012 01:19:24 GMT</pubDate></item><item><title>Paulo Köch commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Very elegant. My hat is off to you. Again. :P</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment10</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment10</guid><pubDate>Fri, 01 Jun 2012 16:12:50 GMT</pubDate></item><item><title>Jason Pettys commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Beautiful solution.</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment9</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment9</guid><pubDate>Fri, 01 Jun 2012 16:04:54 GMT</pubDate></item><item><title>Paul Stovell commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>+1 to Omer's suggestion of using an enum. True/false is ambiguous here. 

</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment8</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment8</guid><pubDate>Fri, 01 Jun 2012 15:16:43 GMT</pubDate></item><item><title>Daniel commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>I'm curious. Why returning true/false instead of having an IgnoreError property on one of the parameters?</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment7</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment7</guid><pubDate>Fri, 01 Jun 2012 11:24:02 GMT</pubDate></item><item><title>Ayende Rahien commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Knagis,
You are welcome to handle this in any way you see fit. 
You can introduce your own logic, build your own decisions, etc.
And we only need a single event handler that returns true.</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment6</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment6</guid><pubDate>Fri, 01 Jun 2012 11:11:01 GMT</pubDate></item><item><title>Omer Mor commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Oren,
I suggest you change the signature of the OnError event to return an enum instead of a bool. This would be more self-documenting.

That way you'll return something like ErrorHandling.Handled or ErrorHandling.RethrowException.

What do you think?</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment5</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment5</guid><pubDate>Fri, 01 Jun 2012 11:09:34 GMT</pubDate></item><item><title>Damien commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Knaģis - I think you may have answered the first part of your question with the second. I presume the return value is meant to represent "handled". If there's one style of query that needs special handling, register it as an earlier event handler, and leave the "generic" handler as the last one subscribed. So "the" event handler doesn't grow uncontrollably, because you register multiple ones.

Of course, I might be completely misreading the intent of this design.</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment4</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment4</guid><pubDate>Fri, 01 Jun 2012 10:24:38 GMT</pubDate></item><item><title>Knaģis commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Won't this result in the OnError handler growing out of proportion since in more complex usage scenarios it will have to be extended to analyse each different query to determine if it is allowed to continue? What about a scenario where the same query can be partial (for example, displaying posts to the user in a webpage) and cannot be partial (for example, the same posts but now for some sort of persistant media)? I'm all for global solutions but I always try to use that for defaults but allow the dev to override it where needed.

Also why do you designed the OnError with a return value instead of using EventArgs? What happens if two handlers return True and one - False?</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment3</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment3</guid><pubDate>Fri, 01 Jun 2012 10:19:42 GMT</pubDate></item><item><title>Ayende Rahien commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Vlad,
I don't see a reason to try to have different behaviors for different sessions, in most cases, you simply won't have any need for that, and when you do, you can handle that yourself.</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment2</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment2</guid><pubDate>Mon, 09 Apr 2012 18:20:59 GMT</pubDate></item><item><title>Vlad commented on API Design: Sharding Status for failure scenarios&amp;ndash;Solving at the right granularity</title><description>Oren, I agree that additional parameters for data retrieving methods like Load&lt;&gt; is bad way because pure abstraction of repository will be broken. At this stage user should not have possibility to manage/audit low-level logic. And solution described in this post possibly is better because ShardAccessStrategy is responsible point for sharding behavior definition.
But ShardAccessStrategy belongs to ShardedDocumentStore which is not user action- (request-) specific as IDocumentSession. If we have a system using principle request/response we need to use some state related to DocumentStore that's no good. I suggest to make this session-related. 
1. IDocumentStore.OpenSession(). Usual session fabric method.
2. IDocumentStore.OpenSession(ISessionErrorHandler). Additional fabric method.
3. ShardedDocumentStore{//try-catch on ShardAccessStrategy.Apply(commands) and if ISessionErrorHandler == null then throw;}
I'm not sure that is the best solution.
</description><link>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment1</link><guid>http://ayende.com/155937/api-design-sharding-status-for-failure-scenarios-solving-at-the-right-granularity#comment1</guid><pubDate>Mon, 09 Apr 2012 16:15:26 GMT</pubDate></item></channel></rss>