rest – Is rebooting a server idempotent or not?

In his article RESTful Casuistry, Tim Bray claims that rebooting a server is not idempotent:

But I don’t buy it, and here’s why. If I want to update some fields in an existing resource, I’m inclined to think about PUT. But that doesn’t work because it’s supposed to be idempotent, and rebooting a server sure isn’t. Well, OK, do it with POST I guess; no biggie.

Yet in comments Mike Kelly states that it is:

The problem I see here is that ’switching’ to reboot does, infact, seem like an idempotent action – the idea being that a ‘rebooting’ state would actually be a graceful shutdown, to an off state, and back to an on state immediately. Once this rebooting state was initiated any further updates to the rebooting state would be idempotent:

PUT /vm/test-machine/power

{ ’state’: ‘rebooting’ }

The definition of idempotence is given in RFC 7231, § 4.2.2. ‘Idempotent Methods’:

A request method is considered “idempotent” if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.

Like the definition of safe, the idempotent property only applies to what has been requested by the user; a server is free to log each request separately, retain a revision control history, or implement other non-idempotent side effects for each idempotent request.

Idempotent methods are distinguished because the request can be repeated automatically if a communication failure occurs before the client is able to read the server’s response. For example, if a client sends a PUT request and the underlying connection is closed before any response is received, then the client can establish a new connection and retry the idempotent request. It knows that repeating the request will have the same intended effect, even if the original request succeeded, though the response might differ.

The intended effect in our situation is that the server has rebooted. I think this will be the case after both a single or multiple reboot requests. So I am inclined to agree with Mike Kelly that rebooting a server is idempotent. But I don’t share his view that it is because subsequent reboot requests during the rebooting phase do not produce any side effects; to me it is because subsequent reboot requests after the rebooting phase produce the same side effects.

Is rebooting a server idempotent or not?

ra.rings and algebras – $r(a) = r(a^2)$ implies $r(a) = eR$ and $r(1-a) subseteq (1-e)R$ for some idempotent $e$?

Let $R$ be a (commutative or non-commutative) unital ring, fix $a in R$, and denote by $r(cdot)$ the right annihilator of an element.

Question. If $r(a)$ is a (right) direct summand of $R$ and $r(a) = r(a^2)$, does there exist an idempotent $e in R$ such that $r(a) = eR$ and $r(1-a) subseteq (1-e)R$?

It is obvious that $r(a) cap r(1-a) = {0}$ and hence the sum $r(a) + r(1-a)$ is direct. Moreover, it is not difficult to check that $r(a) oplus r(1-a) = r(a-a^2)$. So, we see that the answer to the question is yes when $R$ is a right Rickart ring, that is, a ring where every right annihilator is a direct summand. (This is, in a way, a trivial consequence of the definitions and has nothing to do with the “if” clause of the question.)

On the other hand, it is perhaps worth noting that $r(1-a) subseteq aR$ and, if $r(a) = r(a^2)$, then $r(a) cap aR = {0}$.

microservices – How to make consumer idempotent when publisher publishes “at least once”?

I’m trying to implement microservices and I’m still super new to the subject, but, I was able to answer most of questions.

However, one of the questions that I can’t come up with a good solution to is how do I make my consumer idempotent when my publisher publishes at least once?

Graph A

What happens without making Consumer idempotent:

Our consumer receives Event A multiple times, and Event A is asking to pay X dollar to User A, without handling this correctly, we’ve paid User A 3 * X times.

Possible solution

What I’ve come up with is this solution:

We create an Events table in Service A (publisher), we create an entity with an id and serviceName (in this case serviceA) inside Events table, then we proceed to publish the event.

In Service B (consumer), we create a ReceivedEvents table, which holds both eventId and serviceName as primary key, this way, whenever we have a new event, we will first check if the event is inside ReceivedEvents, if not, we proceed to complete the task.

Is this approach good enough? Is there an alternative to this approach?

ra.rings and algebras – Example of idempotent left quasigroups which are right-distributive but not left-distributive

I am looking for examples of the following algebraic structure: a set (X,.) which satisfy the axioms

(idempotent) x.x = x

(left quasigroup) the equation a.x = b has a unique solution denoted by x = a*b

(right distributive) (x ? y) ! z = (x ! z) ? (y ! z) , where ? and ! are any of the operations . or *

but not the axiom

(left distributive) x ! (y ? z) = (x ! y) ? (x ! z) for any choice of the operations ? and ! among . and *

With the help of the (idempotent) axiom, the (right distributive) and (left distributive) may be rewritten as (right medial) and (left medial) axioms, so the question may be rephrased as: give (as many as possible) examples of idempotent left quasigroups which are right medial but not left medial.

co.combinatorics – Does the non-extreme point operator of a closure space being idempotent, imply said space is a matroid (in flat lattice form)?

Given any set $X$ and some closure operator $text{cl}:2^Xto 2^X$ on $X$, we define $psi:2^Xto 2^X$ so that $psi(Q)={qin Q:qintext{cl}(Qsetminus{q})}$ for all $Qsubseteq X$, now if $forall Ssubseteq X(psi(psi(S))=psi(S))$ (i.e. if $psi$ is idempotent) must $text{cl}$ be the closure operator of some matroid?

Sorry if this is either trivially true or trivially false as I am still new to matroid theory.

I know that if $text{cl}$ is the closure operator of a matroid then $psi$ must be idempotent so the converse statement holds. Further I have been able to reduce the problem to proving $mathscr{C}={Csubseteq X:psi(C)neq emptysetlandbigcup_{Ssubset S}psi(C)=emptyset}$ is such that for all $C_1,C_2in mathscr{C}$ we have $ein C_1cap C_2implies exists C_3in mathscr{C}:C_3subseteq (C_1cup C_2)setminus {e}$ i.e. that the family of sets $mathscr{C}$ satisfies the matroid circuit axioms. This is because if $text{cl}$ is the closure operator of a matroid $M$ grounded on $X$, then $psi$ maps every $Ssubseteq X$ to the maximal cyclic set of $M$ in $S$ or in other words $psi(S)$ is the union of all circuits of $M$ contained in $S$, so in particular the closure operator $text{cl}^*:2^Xto 2^X$ of the dual matroid $M^*$ of $M$ satisfies $text{cl}^*(Q)=Xsetminuspsi(Xsetminus Q)$ for all $Qsubseteq X$.

Prove or disprove if $T$ be idempotent t-norm and $a

Let $T : (0, 1)times (0, 1) rightarrow (0, 1)$. A $t$-norm is a function $T$ with properties:

  1. $ T (x, 1) = x$

  2. If $yleq z$ then $T(x,y)leq T(x,z)$

  3. $T (x, y) = T (y, x) $

  4. $T (x, T (y, z)) = T (T (x, y), z) $

$T$ said to be a idempotent t-norm if for all $xin(0,1)$, $T(x,x)=x$.

Prove or disprove:

Let $T$ be idempotent t-norm. If $a<b$ then $T(a,b)=a$ (for all
$a,bin(0,1))$?

If we take example $T(x,y)=min(x,y)$, obviously if $a<b$ then $T(a,b)=a$. Generally, if $T$ be idempotent t-norm and $a<b$ then prove or disprove $T(a,b)=a$?

I don’t have an idea to prove it.

architecture – Idempotent Kafka consumer with an “eventually consistent” database

What are my options if I want to make my Kafka consumer idempotent (due to Kafka’s at-least-once semantics) if my project’s only database is DynamoDB, which is eventually consistent?

I’m afraid setting the “consistent read” flag might slow down and overload the leader node;

I have neither control over the topics I consume nor over the Kafka cluster.

How can I make an idempotent projection to an Hermitian operator in a Hilbert space?

I have tried to solve the following question:

Consider the Hilbert space $R^3$. Find the projection to the 2-dimensional subspace
$$span{|0rangle+|1rangle,|0rangle+|2rangle}$$.

I found the following idempotent operator which projects any vectors to that subspace:
$$
begin{bmatrix}
0 & 1 & 1\
0 & 1 & 0\
0 & 0 & 1
end{bmatrix}.
$$

However, it is not Hermitian. How can I make it Hermitian? or should I find another solution which is both Hermitian and idempotent, can anyone guide me please?

On the other hand, if I change the Hilbert space in question to $C^3$, is the solution differ?

ct.category theory – is the inclusion of his 3-skeleton in the walking idempotent homotopic cofinal?

To let $ Idem $ be the walking idemotent (1) and let $ Idem ^ {(3)} $ be his 3 skeleton. Note that $ Idem $ has a non-degenerate simplex in every dimension. Lurie has shown (2):

  • If $ X $ is a quasi category, then the card $ X to Delta ^ 0 $ has the right lifting ability in terms of absorption $ Idem ^ {(3)} to Idem $;;

That is, although a homotopy-coherent idement contains infinitely many coherence data that correspond to the infinite number of non-degenerate simplifications of $ Idem $Nevertheless, it is guaranteed that all this data is available as soon as the first 3 have been found.

The evidence is a bit complicated and I haven't studied it in detail, but what I understand seems to suggest a positive answer to the following

Question: Is the recording $ Idem ^ {(3)} to Idem $ Homotopy cofinal (i.e. it is cofinal in the $ infty $-Categorical sense – Depending on how you define this, it may be necessary to replace Joyal-fibrant $ Idem ^ {(3)} $ before the question makes sense)?

In fact, I think the answer to the question is "yes" and a proof with "$ bullet $"above, but the evidence I have is somewhat confused. I would prefer direct combinatorial evidence. Unfortunately, I don't believe the recording $ Idem ^ {(3)} $ if anodyne is correct, every proof will have some complications.

One idea would be to use the usual card $ N to Idem ^ {(3)} $, Where $ N $ is the 1-skeleton of natural numbers $ mathbb N $ considered as an ordered set. For receiving $ N to mathbb N $ is a categorical equivalence, and that's easy to show $ mathbb N to Idem $ is homotopy-cofinal according to Quillens Theorem A (since the relevant slice categories are just ordinary 1 categories). By composition, $ N to Idem $ homotopy is cofinal, but this has an effect $ Idem ^ {(3)} $, Through a cofinality cancellation feature to show this $ Idem ^ {(3)} to Idem $ if homotopia is cofinal, it will suffice to show that $ N to Idem ^ {(3)} $ is homotopia cofinal, which sounds simple since then $ N $ and $ Idem ^ {(3)} $ are finite dimensional. But I'm not sure if the relevant slice objects are finite-dimensional …

(1) That is, $ Idem $ is the category with an object and a non-identity morphism $ i $to satisfy the equation $ i ^ 2 = i $, In this question, I identify 1 categories with their nerves, which are quasi categories.

(2) HTT 4.4.5.20 in the current version. This does not appear in the published version of HTT. It appears in older versions of HA as 7.3.5.14, but was moved to HTT when Lurie rewrote the section on Idempotente in HTT.