如何在分散的事件源数据库中处理共识?(How to handle consensus in a decentralized event sourced database?)
假设我有一个X服务器的动态网络(不是随时间修复的),只有附加数据库中的所有事件的相同副本。 现在,我想支持在这10台服务器中的任何一台上创建新事件,并让它们达成共识,复制事件,并且所有事件都会产生完全相同的事件顺序。 我知道这是一个常见的问题,并且有一些算法应该处理这样的事情。 但我并没有完全掌握它们,而且我对有关事件采购的共识有几个问题。
我认为服务器永远不能完全确定它认为已经达成共识的价值真的最终是“正确的”价值吗? 我的基础是,新服务器可以随时加入网络,并提供平衡以支持其他价值。 这可能会在很晚的时候发生。 但在这种情况下,服务器应如何处理新的“正确”值? 在事件采购中,附加补偿事件以进行更正是正常的,但是这些补偿事件是否必须同时复制到所有服务器? 确保所有服务器都具有完全相同的事件。
如果不添加补偿事件,而只是“弹出”已经提交的事件,我们不必复制这些我猜,但后来我们会遇到其他问题。 如果(错误地)提交的事件在事件总线上发送,以便其他服务可以对它们作出反应,我们不能只是从我们的事件数据库中弹出它们而不会弄乱它们。
或者,如果在一小段时间内达成共识后真正致力于价值,那会更好吗? 然后用冷手对待所有新/迟到的服务器? 让他们接受结果呢? 如果新服务器连接到比第一个更大的自己的网络并且他们都已经达成了对另一个值的共识,该怎么办?
Lets say I have dynamic network of X servers (not fixed over time) with a identical copy of all events in a append only database. Now I'd like to support creating new events on any of these 10 servers and have them reach consensus, replicate the events and all result in the exact same event order. I understand this is a common problem and that there are algorithms that are supposed to handle things like this. But I don't fully grasp them and I have a few questions regarding consensus in relation to event sourcing in particular.
I assume that a server never can be completely sure that the value it think it has reached consensus about is really what ends up being the "correct" value? I base this on the fact that new servers can join to the network at any time and tip the balance to favor another value. This could potentially happen much later as well. But in this case, how should a server handle a new "correct" value? In event sourcing it is normal to append compensating events to make corrections but shouldn't these compensating event have to be replicated to all servers as well then? To make sure that all servers have the exact same events I mean.
If not adding compensating event but instead just "popping" already committed events we wouldn't have to replicate these I guess but then we would run into other problems instead. If the (wrongly) committed events are sent out on a event bus so that other services can react to them we can't just pop them from our event db without messing things up.
Or is it better to just really commit to a value once consensus have been reached within a small timeframe? And then treat all new/late servers with a cold hand? Make them accept the result anyway? What if the new server is connected to it's own network that is larger then the first one and they all have reached consensus on another value?
原文:https://stackoverflow.com/questions/47391523
最满意答案
从子
MovieClip
调用函数作为gotoAndPlay的参数输入帧例如,给定具有实例名称
childMovieClip
的符号childMovieClip.gotoAndPlay(2);
Call function from the child
MovieClip
entering the frame as parameter to gotoAndPlayFor example, given a symbol with instance name
childMovieClip
childMovieClip.gotoAndPlay(2);
相关问答
更多-
傻我! 我变了 _root.removeChild(this); 至 this.gotoAndPlay(2); 然后在我的爆炸片结束时我补充道 this.parent.removeChild(this); Silly me! I changed _root.removeChild(this); to this.gotoAndPlay(2); and then at the end of my explosion clip I added this.parent.removeChild(this); ...
-
我必须警告你,将代码放入MovieClip是一种过时的方法,应该避免。 将代码放入不同的框架总会引起更多麻烦。 但是,在阅读完代码后,我相信这应该可以回答您的问题。 请注意,大部分解释都在代码的注释中,因此请继续阅读。 import flash.text.*; import flash.display.Stage; /*You need a reference to each of these library instances, but you were creating two references ...
-
我认为你应该这样做:(评论在代码中) symbol_2.addEventListener(MouseEvent.CLICK, function(e){ trace(e.currentTarget.name) // trace the name of symbol_2, gives you of course symbol_2 trace(e.currentTarget.parent.name) // trace the name of the parent ...
-
为什么你需要让当前帧停止或播放? 你应该只能调用play()等。 我的意思是,如果剪辑已经在currentFrame(它是),那么就没有必要去那个帧开始播放了。 Why do you need to get the current frame to stop or play? You should just be able to call play() etc. I mean, if the clip is already at currentFrame (it is), then there's no n ...
-
如果你调用my_animation.play(); 与“ for循环”一样,它只是连续调用5次,它只是开始动画。 如果你调用my_animation.play(); 在my_animation的动画期间没有任何反应。 如果停止了它就有用了...... 。 所以你需要监听添加回调以了解动画已经完成,你可以再次启动动画.. var animatedCount:int = 0; my_animation.addFrameScript(my_animation.totalFrames-1, onMyAnimatio ...
-
你试过把它投射到MovieClip吗? var mc:MovieClip = this.getChildByName("mc1") as MovieClip; if(mc) { mc.gotoAndPlay(); } Did you try to cast it to a MovieClip? var mc:MovieClip = this.getChildByName("mc1") as MovieClip; if(mc) { mc.gotoAndPlay(); }
-
用户可以删除SharedObjects。 玩家可以删除该文件并重新开始。 如果有登录名,则应使用服务器端脚本(php,asp等)将该数据存储在服务器上 因此,在开头添加一个检查,让用户在他的名字尚未存储在服务器上时播放。 比在游戏开始时调用此列表形式的flash。 对于浏览器崩溃,您只能在游戏结束时存储数据。 因此,当您刷新页面时,您可以再次启动它。 如果没有用户名,你应该获得其他数据,但它并不是那么简单,因为IP可以改变,更多重要的数据无法被flash播放器检索(你可以使用AIR制作的桌面应用程序) 。 ...
-
关于这一点的棘手问题是处理框架的“实时循环”...... 我这样做的方式是: 为FRAME_CONSTRUCTED添加事件侦听器 发送您的movieclip并将其停在所需的框架上。 将您的符号附加在事件的处理程序上。 像这样的东西: mc.addEventListener(Event.FRAME_CONSTRUCTED, _addChild ); mc.gotoAndStop(2); function _addChild(e:Event):void{ mc.addChild( new Square) ...
-
从子MovieClip调用函数作为gotoAndPlay的参数输入帧 例如,给定具有实例名称childMovieClip的符号 childMovieClip.gotoAndPlay(2); flash.display.MovieClip gotoAndPlay Call function from the child MovieClip entering the frame as parameter to gotoAndPlay For example, given a symbol with insta ...
-
你得到了隐式强制错误,因为你的narratorAlphabetSounds对象是一个Sound对象而不是SoundChannel ..然后播放你的声音并检测它何时完成播放,你应该使用Sound和SoundChannel对象,如下所示: var sound:Sound = new narratorAlphabetSounds(); var sound_channel:SoundChannel = sound.play(); sound_channel.addEventListener(Event.S ...