"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3471],{1322:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>u,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"XXTLanControl.lua/kvdb/queue/move","title":"Atomically Move Queue Items (LCC.kvdb.queue.move)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/queue/move.md","sourceDirName":"XXTLanControl.lua/kvdb/queue","slug":"/XXTLanControl.lua/kvdb/queue/move","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/move","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":60,"frontMatter":{"sidebar_position":60},"sidebar":"tutorialSidebar","previous":{"title":"Pop From Queue Back (LCC.kvdb.queue.pop_back)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/pop_back"},"next":{"title":"Remove Items By Value (LCC.kvdb.queue.pop_values)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/pop_values"}}');var r=o(4848),s=o(8453);const u={sidebar_position:60},i="Atomically Move Queue Items (LCC.kvdb.queue.move)",l={},a=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function c(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"atomically-move-queue-items-lcckvdbqueuemove",children:"Atomically Move Queue Items (LCC.kvdb.queue.move)"})}),"\n",(0,r.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:"value, err = LCC.kvdb.queue.move(from_name, pop?, to_name, push?, timeout?)\n"})}),"\n",(0,r.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["from_name",(0,r.jsx)(n.br,{}),"\n","String. Source queue name (non-empty, max ",(0,r.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,r.jsxs)(n.li,{children:["pop",(0,r.jsx)(n.br,{}),"\n","String, optional. Pop direction of the source queue, ",(0,r.jsx)(n.code,{children:'"front"'})," or ",(0,r.jsx)(n.code,{children:'"back"'}),"; defaults to ",(0,r.jsx)(n.code,{children:'"front"'}),"."]}),"\n",(0,r.jsxs)(n.li,{children:["to_name",(0,r.jsx)(n.br,{}),"\n","String. Destination queue name (non-empty, max ",(0,r.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,r.jsxs)(n.li,{children:["push",(0,r.jsx)(n.br,{}),"\n","String, optional. Push direction for the destination queue, ",(0,r.jsx)(n.code,{children:'"front"'})," or ",(0,r.jsx)(n.code,{children:'"back"'}),"; defaults to ",(0,r.jsx)(n.code,{children:'"back"'}),"."]}),"\n",(0,r.jsxs)(n.li,{children:["timeout",(0,r.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,r.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["value",(0,r.jsx)(n.br,{}),"\n","String. The moved entry; ",(0,r.jsx)(n.code,{children:"nil"})," when the source queue is empty."]}),"\n",(0,r.jsxs)(n.li,{children:["err",(0,r.jsx)(n.br,{}),"\n","String or ",(0,r.jsx)(n.code,{children:"nil"}),". Returns ",(0,r.jsx)(n.code,{children:"'not found'"})," on empty source queues or when the operation fails."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["Atomically pops from the source queue and pushes into the destination.",(0,r.jsx)(n.br,{}),"\n","Ideal for task hand-offs without race conditions.\nReturns ",(0,r.jsx)(n.code,{children:"nil, 'not found'"})," when the source queue is empty."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:'local value, err = LCC.kvdb.queue.move("pending", "front", "running", "back")\nif value then\n    print("Claimed", value)\nend\n'})})]})}function d(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,n,o)=>{o.d(n,{R:()=>u,x:()=>i});var t=o(6540);const r={},s=t.createContext(r);function u(e){const n=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:u(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]);