Home | History | Annotate | Download | only in pgfs

Lines Matching defs:xc

68 dumperror(struct Xconn *xc, const PGresult *res)
112 struct Xconn *xc;
116 TAILQ_FOREACH(xc, &xclist, list) {
117 if (xc->blocker == NULL) {
118 assert(xc->owner == NULL);
119 xc->owner = cc;
120 DPRINTF("xc %p acquire %p\n", xc, cc);
121 return xc;
123 assert(xc->owner == xc->blocker);
132 relxc(struct Xconn *xc)
135 assert(xc->in_trans);
136 assert(xc->owner != NULL);
137 xc->in_trans = false;
138 xc->owner = NULL;
143 pqwait(struct Xconn *xc)
145 PGconn *conn = xc->conn;
146 struct puffs_cc *cc = xc->owner;
154 assert(xc->blocker == NULL);
155 xc->blocker = cc;
160 assert(xc->owner == cc);
161 assert(xc->blocker == cc);
162 xc->blocker = NULL;
270 fetch_noresult(struct Xconn *xc)
274 PGconn *conn = xc->conn;
277 pqwait(xc);
294 dumperror(xc, res);
310 preparecmd(struct Xconn *xc, struct cmd *c)
312 PGconn *conn = xc->conn;
313 const uint32_t mask = 1 << xc->id;
327 error = fetch_noresult(xc);
343 vsendcmd(struct Xconn *xc, int resultmode, struct cmd *c, va_list ap)
345 PGconn *conn = xc->conn;
353 assert(xc->owner != NULL);
354 assert(xc->blocker == NULL);
355 error = preparecmd(xc, c);
453 sendcmd(struct Xconn *xc, struct cmd *c, ...)
459 error = vsendcmd(xc, 0, c, ap);
465 sendcmdx(struct Xconn *xc, int resultmode, struct cmd *c, ...)
471 error = vsendcmd(xc, resultmode, c, ap);
482 simplecmd(struct Xconn *xc, struct cmd *c, ...)
488 error = vsendcmd(xc, 0, c, ap);
493 return fetch_noresult(xc);
497 fetchinit(struct fetchstatus *s, struct Xconn *xc)
499 s->xc = xc;
523 PGconn *conn = s->xc->conn;
531 pqwait(s->xc);
542 dumperror(s->xc, s->res);
630 while ((res = PQgetResult(s->xc->conn)) != NULL) {
641 simplefetch(struct Xconn *xc, Oid type, ...)
647 fetchinit(&s, xc);
662 setlabel(struct Xconn *xc, const char *label)
676 if (label != NULL && label != xc->label) {
683 error = simplecmd(xc, c);
686 xc->label = label;
692 error = simplecmd(xc, c);
701 struct Xconn *xc = getxc(puffs_cc_getcc(pu));
705 setlabel(xc, label);
707 assert(!xc->in_trans);
708 error = simplecmd(xc, c);
710 assert(PQtransactionStatus(xc->conn) == PQTRANS_INTRANS);
711 xc->in_trans = true;
712 return xc;
718 struct Xconn *xc = getxc(puffs_cc_getcc(pu));
722 setlabel(xc, label);
724 assert(!xc->in_trans);
725 error = simplecmd(xc, c);
727 assert(PQtransactionStatus(xc->conn) == PQTRANS_INTRANS);
728 xc->in_trans = true;
729 return xc;
733 rollback(struct Xconn *xc)
741 status = PQtransactionStatus(xc->conn);
750 error = simplecmd(xc, c);
753 DPRINTF("xc %p rollback %p\n", xc, xc->owner);
754 setlabel(xc, NULL);
755 relxc(xc);
759 commit(struct Xconn *xc)
765 error = simplecmd(xc, c);
766 setlabel(xc, NULL);
768 DPRINTF("xc %p commit %p\n", xc, xc->owner);
769 relxc(xc);
775 commit_sync(struct Xconn *xc)
782 error = simplecmd(xc, c);
784 return commit(xc);
790 struct Xconn *xc = vp;
793 fprintf(stderr, "got a notice on %p\n", xc);
794 dumperror(xc, res);
801 struct Xconn *xc;
804 TAILQ_FOREACH(xc, &xclist, list) {
805 if (PQsocket(xc->conn) == fd) {
809 assert(xc != NULL);
810 conn = xc->conn;
813 if (xc->blocker != NULL) {
814 DPRINTF("schedule %p\n", xc->blocker);
815 puffs_cc_schedule(xc->blocker);
861 struct Xconn *xc;
882 xc = emalloc(sizeof(*xc));
883 xc->conn = conn;
884 xc->blocker = NULL;
885 xc->owner = NULL;
886 xc->in_trans = false;
887 xc->id = xcid++;
888 xc->label = NULL;
889 assert(xc->id < 32);
890 PQsetNoticeReceiver(conn, pgfs_notice_receiver, xc);
891 TAILQ_INSERT_HEAD(&xclist, xc, list);
893 assert(xc2 == xc);
895 error = simplecmd(xc, c);
901 error = simplecmd(xc, c);
905 error = simplecmd(xc, c);
911 error = simplecmd(xc, c);
922 error = sendcmd(xc, c);
924 fetchinit(&s, xc);
928 DPRINTF("xc %p backend pid %" PRIu64 "\n", xc, pid);
930 error = commit(xc);
932 assert(xc->owner == NULL);
948 struct Xconn *xc;
980 xc = begin(pu, "flush");
983 error = sendcmd(xc, c);
987 error = simplefetch(xc, INT8OID, &dummy);
999 error = commit_sync(xc);
1005 rollback(xc);