atmi

package module
v8.0.4+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: LGPL-3.0 Imports: 7 Imported by: 13

README

Application Server for GO (ASG)

Version: v8.0.0 - Using Object-mode API.

ASG is application server for Golang, which makes it possible to process distributed transactions in Golang. It is possible to reload the application components without service interruption. Basically system is service oriented where server components advertises services (service is just a literal name like "GETBALANCE", "TRXREQ", etc.), then later these services are called by client binaries. Clients and servers can be located on different physical machines and they can call each other with out knowledge of their psychical location. As these server binaries are stateless, they can be started in multiple copies. This ensures fault tolerant processing. Clients and Server Services comunicate via middleware which supports three kind of buffers for request/response data: Arbitrary string, Byte array, Unified Buffer Format (UBF), JSON buffer.

Branches

  • If building against Enduro/X 8.0, use v8.0 branch, i.e. $ go get github.com/endurox-dev/endurox-go@v8.0

Build & test status

OS Status OS Status OS Status
RHEL/Oracle Linux 8 Build Status Centos 6 Build Status FreeBSD 11 Build Status
Oracle Linux 7 Build Status OSX 11.4 Build Status raspbian10_arv7l Build Status
SLES 12 Build Status SLES 15 Build Status Ubuntu 14.04 Build Status
Ubuntu 18.04 Build Status AIX 7.2 Build Status

Documentation

The Enduro-GO API Document

Enduro/X documentation is located here: http://www.endurox.org/dokuwiki

Basic ASG application layouts can be checked out from this repository "tests" folder.

Foundation

ASG is built on Enduro/X middleware framework, which by itself implements extended XATMI specification. For distributed transaction processing XA API is used. XA must be supported by underlaying SQL (or any other resource) driver. The platform is build on GNU/Linux technology and it utilizes Posix kernel queues for gaining high IPC throughput.

Before try to build ASG, you need to install Enduro/X Middleware Platform, https://github.com/endurox-dev/endurox Binary packages for Enduro/X are available here: http://www.endurox.org/projects/endurox/files

Persistent message queue

Enduro/X provides a queuing subsystem called TMQ (Transactional Message Queue). This facility provides persistent queues that allows applications to explicitly enqueue and dequeue messages from named queues. Queues can be ordered by message en-queue time in LIFO or FIFO order. Queues are managed by an XA compliant resource manager allowing queue operations to participate in distributed transactions. An automated queue forwarding feature is provided that will remove entries from a queue and invoke an associated Enduro/X ATMI services, placing the reply message on an associated reply queue and failed messages to failure queue. The basic usage of persistent queues can be checked in tests/07_basic_durable_queue folder. TMQ API consists of TpEnqueue() and TpDequeue() calls or automated dequeue and message forwarding to destination service.

Buffer Types

Typed buffers are used for data transport between services.

String buffer

It is possible to send to services arbitrary strings. These could be JSON, XML or whatever data. The service might respond with the same buffer format, with changed contents.

Byte array (Carray)

It is possible to send to services byte arrays. The data could include binary zeros.

Unified Buffer Format buffer

UBF buffer basically is hash-list where for each value there could be array of elements (e.g. one or more). The buffer is typed. Fields are predefined in field definition tables, later with Enduro/X's 'mkfldhdr -m1' can be generated field constant tables which provides go format.

JSON buffer

JSON Text format buffer is supported. This can be used to call Enduro/X server or receive JSON format calls from the system.

XA SQL Drivers

Currently Enduro/X supports Oracle DB OCI driver. The patched version for XA processing is available here: https://github.com/endurox-dev/go-oci8. When doing processing in XA mode, the connection string must be empty ("").

Contact

Forums: http://www.endurox.org/projects/endurox-go/boards

Releases

  • Version 8.0.0 released on 09/01/2022 (stable) Support #754, Support #780
  • Version 8.0.2 released on 07/03/2023 (stable) Support #800
  • Version 8.0.4 released on 10/02/2024 (stable) Bug #825

Documentation

Overview

*

  • @brief XATMI main package

  • NOTES for finalizers! Note that if we pass from finalized object (typed ubf,

  • expression tree or ATMI Context) pointer to C, the and the function call

  • for the object is last in the object's go scope, the go might being to GC

  • the go object, while the C function have received pointer in args. Thus

  • C side in the middle of processing might get destructed object. e.g.

  • c_str := C.BPrintStrC(&u.Buf.Ctx.c_ctx, (*C.UBFH)(unsafe.Pointer(u.Buf.C_ptr)))

  • after enter in C.BPrintStrC(), the GC might kill the u object. Thus to avoid

  • this, we create a defered "no-op" call in the enter of go func. With "u.Buf.nop()"

  • at the end of the functions. *

  • @file atmi.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief XATMI main package, server API *

  • @file atmisrv.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief TPLOG - text logging and debuging API provided by Enduro/X *

  • @file tplog.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief Typed C-Array (binary array) IPC buffer support *

  • @file typed_carray.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief JSON IPC Buffer support *

  • @file typed_json.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief Plain text IPC buffer support *

  • @file typed_string.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief Unified Buffer Format (UBF) - Key value protocol buffer support *

  • @file typed_ubf.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief Unified Buffer Format (UBF) marshal/unmarshal to/from structures *

  • @file typed_ubf_tag.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

*

  • @brief VIEW buffer support - dynamic access *

  • @file typed_view.go

    -----------------------------------------------------------------------------

  • Enduro/X Middleware Platform for Distributed Transaction Processing

  • Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.

  • Copyright (C) 2017-2019, Mavimax, Ltd. All Rights Reserved.

  • This software is released under one of the following licenses:

  • LGPL or Mavimax's license for commercial use.

  • See LICENSE file for full text. *

  • C (as designed by Dennis Ritchie and later authors) language code is licensed

  • under Enduro/X Modified GNU Affero General Public License, version 3.

  • See LICENSE_C file for full text.

  • -----------------------------------------------------------------------------

  • LGPL license: *

  • This program is free software; you can redistribute it and/or modify it under

  • the terms of the GNU Lesser General Public License, version 3 as published

  • by the Free Software Foundation; *

  • This program is distributed in the hope that it will be useful, but WITHOUT ANY

  • WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

  • PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 3

  • for more details. *

  • You should have received a copy of the Lesser General Public License along

  • with this program; if not, write to the Free Software Foundation, Inc.,

  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *

  • -----------------------------------------------------------------------------

  • A commercial use license is available from Mavimax, Ltd

  • contact@mavimax.com

  • -----------------------------------------------------------------------------

Index

Constants

View Source
const (
	SUCCEED = 0
	FAIL    = -1
)

* SUCCEED/FAIL flags

View Source
const (
	TPMINVAL      = 0
	TPEABORT      = 1
	TPEBADDESC    = 2
	TPEBLOCK      = 3
	TPEINVAL      = 4
	TPELIMIT      = 5
	TPENOENT      = 6
	TPEOS         = 7
	TPEPERM       = 8
	TPEPROTO      = 9
	TPESVCERR     = 10
	TPESVCFAIL    = 11
	TPESYSTEM     = 12
	TPETIME       = 13
	TPETRAN       = 14
	TPGOTSIG      = 15
	TPERMERR      = 16
	TPEITYPE      = 17
	TPEOTYPE      = 18
	TPERELEASE    = 19
	TPEHAZARD     = 20
	TPEHEURISTIC  = 21
	TPEEVENT      = 22
	TPEMATCH      = 23
	TPEDIAGNOSTIC = 24
	TPEMIB        = 25
	TPINITFAIL    = 30
	TPMAXVAL      = 31
)

* List of ATMI Error codes (atmi.h/xatmi.h)

View Source
const (
	TPNOBLOCK      = 0x00000001
	TPSIGRSTRT     = 0x00000002
	TPNOREPLY      = 0x00000004
	TPNOTRAN       = 0x00000008
	TPTRAN         = 0x00000010
	TPNOTIME       = 0x00000020
	TPGETANY       = 0x00000080
	TPNOCHANGE     = 0x00000100
	TPCONV         = 0x00000400
	TPSENDONLY     = 0x00000800
	TPRECVONLY     = 0x00001000
	TPTRANSUSPEND  = 0x00040000 /* Suspend current transaction          */
	TPSOFTTIMEOUT  = 0x00080000 /* Software time-out, translated to XATMI timeout for caller */
	TPSOFTNOENT    = 0x00100000 /* No service entry                     */
	TPNOAUTBUF     = 0x00200000 /* Don't restore autbuf in srv context  */
	TPREGEXMATCH   = 0x00800000 /* Use regular expressoins for match    */
	TPNOCACHELOOK  = 0x01000000 /* Do not lookup cache                  */
	TPNOCACHEADD   = 0x02000000 /* Do not save data to cache            */
	TPNOCACHEDDATA = 0x04000000 /* Do not use cached data               */
	TPNOABORT      = 0x08000000 /* Do not abort global transaction if svc call failed */
)

* flag bits for C language xatmi routines

View Source
const (
	TPFAIL    = 0x0001
	TPSUCCESS = 0x0002
)

* values for rval in tpreturn

View Source
const (
	TPEV_DISCONIMM = 0x0001
	TPEV_SVCERR    = 0x0002
	TPEV_SVCFAIL   = 0x0004
	TPEV_SVCSUCC   = 0x0008
	TPEV_SENDONLY  = 0x0020
)

* events returned during conversational communication

View Source
const (
	TPTXCOMMITDLOG = 0x00000004 /**< Commit decision logged     */
	TPTXNOOPTIM    = 0x00000100 /**< No known host optimization */

)

* Transaction handling constants

View Source
const (
	TPNOFLAGS         = 0x00000
	TPQCORRID         = 0x00001  /* set/get correlation id */
	TPQFAILUREQ       = 0x00002  /* set/get failure queue */
	TPQBEFOREMSGID    = 0x00004  /* RFU, enqueue before message id */
	TPQGETBYMSGIDOLD  = 0x00008  /* RFU, deprecated */
	TPQMSGID          = 0x00010  /* get msgid of enq/deq message */
	TPQPRIORITY       = 0x00020  /* set/get message priority */
	TPQTOP            = 0x00040  /* RFU, enqueue at queue top */
	TPQWAIT           = 0x00080  /* RFU, wait for dequeuing */
	TPQREPLYQ         = 0x00100  /* set/get reply queue */
	TPQTIME_ABS       = 0x00200  /* RFU, set absolute time */
	TPQTIME_REL       = 0x00400  /* RFU, set absolute time */
	TPQGETBYCORRIDOLD = 0x00800  /* deprecated */
	TPQPEEK           = 0x01000  /* peek */
	TPQDELIVERYQOS    = 0x02000  /* RFU, delivery quality of service */
	TPQREPLYQOS       = 0x04000  /* RFU, reply message quality of service */
	TPQEXPTIME_ABS    = 0x08000  /* RFU, absolute expiration time */
	TPQEXPTIME_REL    = 0x10000  /* RFU, relative expiration time */
	TPQEXPTIME_NONE   = 0x20000  /* RFU, never expire */
	TPQGETBYMSGID     = 0x40008  /* dequeue by msgid */
	TPQGETBYCORRID    = 0x80800  /* dequeue by corrid */
	TPQASYNC          = 0x100000 /* Async complete */
)

* TPQCTL.flags flags

View Source
const (
	QMEINVAL     = -1
	QMEBADRMID   = -2
	QMENOTOPEN   = -3
	QMETRAN      = -4
	QMEBADMSGID  = -5
	QMESYSTEM    = -6
	QMEOS        = -7
	QMEABORTED   = -8
	QMENOTA      = -8 /* QMEABORTED */
	QMEPROTO     = -9
	QMEBADQUEUE  = -10
	QMENOMSG     = -11
	QMEINUSE     = -12
	QMENOSPACE   = -13
	QMERELEASE   = -14
	QMEINVHANDLE = -15
	QMESHARE     = -16
)

* Values for TQPCTL.diagnostic

View Source
const (
	TMMSGIDLEN       = 32
	TMCORRIDLEN      = 32
	TMQNAMELEN       = 15
	NDRX_MAX_ID_SIZE = 96
)

* Q constants

View Source
const (
	LOG_ALWAYS = 1
	LOG_ERROR  = 2
	LOG_WARN   = 3
	LOG_INFO   = 4
	LOG_DEBUG  = 5
	LOG_DUMP   = 6
)

* Log levels for TPLOG (corresponding to ndebug.h)

View Source
const (
	LOG_FACILITY_NDRX       = 0x00001 /* settings for ATMI logging             */
	LOG_FACILITY_UBF        = 0x00002 /* settings for UBF logging              */
	LOG_FACILITY_TP         = 0x00004 /* settings for TP logging               */
	LOG_FACILITY_TP_THREAD  = 0x00008 /* settings for TP, thread based logging */
	LOG_FACILITY_TP_REQUEST = 0x00010 /* Request logging, thread based         */
)

* Logging facilites

View Source
const (
	NEINVALINI  = 1  /* Invalid INI file */
	NEMALLOC    = 2  /* Malloc failed */
	NEUNIX      = 3  /* Unix error occurred */
	NEINVAL     = 4  /* Invalid value passed to function */
	NESYSTEM    = 5  /* System failure */
	NEMANDATORY = 6  /* Mandatory field is missing */
	NEFORMAT    = 7  /* Format error */
	NETOUT      = 8  /* Time-out condition */
	NENOCONN    = 9  /* No connection */
	NELIMIT     = 10 /* Limit reached */
)

* Enduro/X standard library error codes

View Source
const (
	TPEX_NOCHANGE = 0x00000004 /**< Reject tpimport with error if 	*/
	TPEX_STRING   = 0x00000008 /**< Export buffer in base64 format 		*/
)

*

  • Enduro/X extensions
View Source
const (
	BFLD_MIN    = 0
	BFLD_SHORT  = 0
	BFLD_LONG   = 1
	BFLD_CHAR   = 2
	BFLD_FLOAT  = 3
	BFLD_DOUBLE = 4
	BFLD_STRING = 5
	BFLD_CARRAY = 6
	BFLD_MAX    = 6

	BFLD_INT = 7 /* used for views only */
)

Field types

View Source
const (
	BMINVAL   = 0 /* min error */
	BERFU0    = 1
	BALIGNERR = 2
	BNOTFLD   = 3
	BNOSPACE  = 4
	BNOTPRES  = 5
	BBADFLD   = 6
	BTYPERR   = 7
	BEUNIX    = 8
	BBADNAME  = 9
	BMALLOC   = 10
	BSYNTAX   = 11
	BFTOPEN   = 12
	BFTSYNTAX = 13
	BEINVAL   = 14
	BERFU1    = 15
	BBADTBL   = 16
	BBADVIEW  = 17
	BVFSYNTAX = 18
	BVFOPEN   = 19
	BBADACM   = 20
	BNOCNAME  = 21
	BEBADOP   = 22

	BMAXVAL = 22 /* max error */
)

Error codes

View Source
const (
	BBADFLDID   = 0
	BFIRSTFLDID = 0
)
View Source
const (
	BVACCESS_NOTNULL = 0x00000001 //View access mode (return non null values only)
	VIEW_NAME_LEN    = 33         //View name max len
	VIEW_CNAME_LEN   = 256        // View filed max len
)

View flags

View Source
const (
	DETAIL_MODE = "detailed" //Slower, not for production !
)
View Source
const (
	TPNULLCONTEXT = 0 /**< NULL Context */
)

*

  • Multi contexting defines

Variables

View Source
var M_BNext_fldid C.BFLDID //Used for storing last returned field ID as required by Bnext() C API.

Functions

func ATMIMsgSizeMax

func ATMIMsgSizeMax() int64

Max message size @return buffer size configured by Enduro/X, min 64K

func ExSizeOfLong

func ExSizeOfLong() int

Return size of long. Used to detect running platform Basically all int64 APIs used by ATMI package will resolve from Enduro/X point of view this count of bytes. @return number of bytes in "long" data type

func NewATMICtx

func NewATMICtx() (*ATMICtx, ATMIError)

Allocate new ATMI context. This is the context with most of the XATMI operations are made. Single go routine can have multiple contexts at the same time. The function does not open queues or init XATMI sub-system unless the dependant operation is called. For example you may allocat the context and use it for logging that will not make overhead for system queues. @return ATMI Error, Pointer to ATMI Context object

Types

type ATMIBuf

type ATMIBuf struct {
	C_ptr *C.char
	//We will need some API for length & buffer setting
	//Probably we need a wrapper for lenght function
	C_len C.long

	//have finalizer installed
	HaveFinalizer bool

	//Have some context, just a reference to, for ATMI buffer operations
	Ctx *ATMICtx
	// contains filtered or unexported fields
}

ATMI buffer

func (*ATMIBuf) GetBuf

func (u *ATMIBuf) GetBuf() *ATMIBuf

Have inteface to base ATMI buffer

func (*ATMIBuf) TpRealloc

func (buf *ATMIBuf) TpRealloc(size int64) ATMIError

Reallocate the buffer @param buf ATMI buffer @return ATMI Error

func (*ATMIBuf) TpSetCtxt

func (buf *ATMIBuf) TpSetCtxt(ac *ATMICtx)

Change the context of the buffers (needed for error handling)

func (*ATMIBuf) TpTypes

func (ptr *ATMIBuf) TpTypes(itype *string, subtype *string) (int64, ATMIError)

Return ATMI buffer info @param itype ptr to string to return the buffer type (can be nil), if set then on output value will be UBF, CARRAY, STRING or JSON other buffers currently are not supported. @param subtype ptr to string to return sub-type (can be nil) @return Buffer lenght if no error or -1 if error, ATMI error

type ATMICtx

type ATMICtx struct {
	// contains filtered or unexported fields
}

* ATMI Context object

func MakeATMICtx

func MakeATMICtx(c_ctx C.TPCONTEXT_T) *ATMICtx

Make context object from C pointer. Function can be used in case If doing any direct XATMI operations and you have a C context handler. Which can be promoted to Go level ATMI Context. @param c_ctx Context ATMI object @return ATMI Context Object

func (*ATMICtx) AssocThreadWithCtx

func (ac *ATMICtx) AssocThreadWithCtx() ATMIError

Associate current OS thread with context This might be needed for global transaction processing Which uses underlaying OS threads for transaction association

func (*ATMICtx) BBoolCo

func (ac *ATMICtx) BBoolCo(expr string) (*ExprTree, UBFError)

Compile boolean expression TODO: might want auto finalizer with Btreefree! @param expr Expression string @return Expression tree (ptr or nil on error), UBF error

func (*ATMICtx) BBoolPr

func (ac *ATMICtx) BBoolPr(tree *ExprTree) (string, UBFError)

Print the expression tree @param tree Compiled expression tree @return printed expresion string, ubf error

func (*ATMICtx) BBoolSetCBF

func (ac *ATMICtx) BBoolSetCBF(funcname string, f UBFExprFunc) UBFError

Set custom callback function for UBF buffer expression evaluator @param funcname Name of the function to be used in expression @param f callback to function @return UBF error

func (*ATMICtx) BConcat

func (ac *ATMICtx) BConcat(dest *TypedUBF, src *TypedUBF) UBFError

Contact the buffers @param dest dest buffer @param src source buffer @return UBF error

func (*ATMICtx) BCpy

func (ac *ATMICtx) BCpy(dest *TypedUBF, src *TypedUBF) UBFError

Copy buffer @param dest Destination UBF buffer @param src Source UBF buffer @return UBF error

func (*ATMICtx) BFldId

func (ac *ATMICtx) BFldId(fldnm string) (int, UBFError)

Return field ID @param fldnm Field name @return Field ID, UBF error

func (*ATMICtx) BFldNo

func (ac *ATMICtx) BFldNo(bfldid int) int

Return field number @param bfldid field id @return field number

func (*ATMICtx) BFldType

func (ac *ATMICtx) BFldType(bfldid int) int

Return the field type @param bfldid field id @return field type

func (*ATMICtx) BFname

func (ac *ATMICtx) BFname(bfldid int) (string, UBFError)

Get field name @param bfldid Field ID @return Field name (or "" if error), UBF error

func (*ATMICtx) BInit

func (ac *ATMICtx) BInit(u *TypedUBF, ulen int64) UBFError

Initialize/re-initialize UBF buffer @param u UBF buffer @param ulen lenght of the buffer @return UBF error

func (*ATMICtx) BMkFldId

func (ac *ATMICtx) BMkFldId(fldtype int, bfldid int) (int, UBFError)

Generate Field ID @param fldtype Field type (see BFLD_SHORT cost list) @param bfldid field number @return field id or 0 if error, UBF error

func (*ATMICtx) BProjCpy

func (ac *ATMICtx) BProjCpy(dest *TypedUBF, src *TypedUBF, fldlist []int) UBFError

Make a project copy of the fields (leave only those in array) The terminator in the fildlist array are not required. The list shall contain fields only to copy. See *Bprojcpy(3)* for more details. NOTE! The dest buffer is erased before copying new data to @param dest is destination buffer @param src is source buffer to copy from @param fldlist list of fields to copy @return UBF error

func (*ATMICtx) BTreeFree

func (ac *ATMICtx) BTreeFree(tree *ExprTree)

Free the expression buffer

func (*ATMICtx) BUpdate

func (ac *ATMICtx) BUpdate(dest *TypedUBF, src *TypedUBF) UBFError

Update dest buffer with source buffer data @param dest dest buffer @param src source buffer @return UBF error

func (*ATMICtx) BVSizeof

func (ac *ATMICtx) BVSizeof(view string) (int64, UBFError)

Get structure size in bytes. See Bvsizeof(3). @param view View name @return ret (number of view bytes (if no error)), UBFError in case of error

func (*ATMICtx) CastToCarray

func (ac *ATMICtx) CastToCarray(abuf *ATMIBuf) (*TypedCarray, ATMIError)

Get the String Handler

func (*ATMICtx) CastToJSON

func (ac *ATMICtx) CastToJSON(abuf *ATMIBuf) (*TypedJSON, ATMIError)

Get the JSON Handler from ATMI Buffer

func (*ATMICtx) CastToString

func (ac *ATMICtx) CastToString(abuf *ATMIBuf) (*TypedString, ATMIError)

Get the String Handler from ATMI Buffer

func (*ATMICtx) CastToUBF

func (ac *ATMICtx) CastToUBF(abuf *ATMIBuf) (*TypedUBF, ATMIError)

Get the UBF Handler

func (*ATMICtx) CastToVIEW

func (ac *ATMICtx) CastToVIEW(abuf *ATMIBuf) (*TypedVIEW, ATMIError)

Get the view buffer handler. Usually used by service functions when request is received. @param abuf ATMI buffer @return Typed view (if OK), nil on error. ATMI error in case of error or nil

func (*ATMICtx) DisassocThreadFromCtx

func (ac *ATMICtx) DisassocThreadFromCtx() ATMIError

Disassocate current os thread from context This might be needed for global transaction processing Which uses underlaying OS threads for transaction association

func (*ATMICtx) FreeATMICtx

func (ac *ATMICtx) FreeATMICtx()

Free up the ATMI Context Internally this will call the TpTerm too to termiante any XATMI client session in progress.

func (*ATMICtx) NewATMIError

func (ac *ATMICtx) NewATMIError() ATMIError

Generate ATMI error, read the codes

func (*ATMICtx) NewCarray

func (ac *ATMICtx) NewCarray(b []byte) (*TypedCarray, ATMIError)

Allocate new string buffer @param s - source string

func (*ATMICtx) NewJSON

func (ac *ATMICtx) NewJSON(b []byte) (*TypedJSON, ATMIError)

Allocate new JSON buffer @param s - source string

func (*ATMICtx) NewNstdError

func (ac *ATMICtx) NewNstdError() NSTDError

Generate NSTD error, read the codes

func (*ATMICtx) NewString

func (ac *ATMICtx) NewString(gs string) (*TypedString, ATMIError)

Allocate new string buffer @param s - source string

func (*ATMICtx) NewUBF

func (ac *ATMICtx) NewUBF(size int64) (*TypedUBF, ATMIError)

Allocate the new UBF buffer NOTE: realloc or other ATMI ops you can do with TypedUBF.Buf @param size - buffer size @return Typed UBF, ATMI error

func (*ATMICtx) NewUBFError

func (ac *ATMICtx) NewUBFError() UBFError

Generate UBF error, read the codes

func (*ATMICtx) NewVIEW

func (ac *ATMICtx) NewVIEW(view string, size int64) (*TypedVIEW, ATMIError)

Allocate the new VIEW buffer @param size - buffer size, If use 0, then 1024 or bigger view size is allocated. @return TypedVIEW, ATMI error

func (*ATMICtx) TpACall

func (ac *ATMICtx) TpACall(svc string, tb TypedBuffer, flags int64) (int, ATMIError)

TP Async call @param svc Service Name to call @param buf ATMI buffer @param flags Flags to be used for call (see flags section) @return Call Descriptor (cd), ATMI Error

func (*ATMICtx) TpAbort

func (ac *ATMICtx) TpAbort(flags int64) ATMIError

Abort global transaction @param flags flags for abort operation (must be 0) @return ATMI Error

func (*ATMICtx) TpAdvertise

func (ac *ATMICtx) TpAdvertise(svcname string, funcname string, fptr TPServiceFunction) ATMIError

Advertise service @param svcname Service Name @param funcname Function Name @param fptr Pointer to service function, signature "func FUNCNAME(ac *atmi.ATMICtx, svc *atmi.TPSVCINFO)" @return ATMI Error

func (*ATMICtx) TpAlloc

func (ac *ATMICtx) TpAlloc(b_type string, b_subtype string, size int64) (*ATMIBuf, ATMIError)

Allocate buffer Accepts the standard ATMI values We should add error handling here @param b_type Buffer type @param b_subtype Buffer sub-type @param size Buffer size request @return ATMI Buffer, atmiError

func (*ATMICtx) TpAssertEqualError

func (ac *ATMICtx) TpAssertEqualError(a interface{}, b interface{}, message string) error

Have some common testing functinos (used by Enduro/X modules) @param a Paramter a to test @param b Paramter b to test (compare with a) @param message additional error message

func (*ATMICtx) TpAssertEqualPanic

func (ac *ATMICtx) TpAssertEqualPanic(a interface{}, b interface{}, message string)

Have some common testing functinos (used by Enduro/X modules) @param a Paramter a to test @param b Paramter b to test (compare with a) @param message additional error message

func (*ATMICtx) TpAssertNotEqualError

func (ac *ATMICtx) TpAssertNotEqualError(a interface{}, b interface{}, message string) error

Have some common testing functinos (used by Enduro/X modules) @param a Paramter a to test @param b Paramter b to test (compare with a) @param message additional error message

func (*ATMICtx) TpAssertNotEqualPanic

func (ac *ATMICtx) TpAssertNotEqualPanic(a interface{}, b interface{}, message string)

Have some common testing functinos (used by Enduro/X modules) @param a Paramter a to test @param b Paramter b to test (compare with a) @param message additional error message

func (*ATMICtx) TpBegin

func (ac *ATMICtx) TpBegin(timeout uint64, flags int64) ATMIError

Begin transaction @param timeout Transaction Timeout @param flags Transaction flags @return ATMI Error

func (*ATMICtx) TpCall

func (ac *ATMICtx) TpCall(svc string, tb TypedBuffer, flags int64) (int, ATMIError)

Do the service call, assume using the same buffer for return value. This works for self describing buffers. Otherwise we need a buffer size in ATMIBuf. @param svc service name @param buf ATMI buffer @param flags Flags to be used @return atmiError

func (*ATMICtx) TpCancel

func (ac *ATMICtx) TpCancel(cd int) ATMIError

Cancel async call @param cd Call descriptor @return ATMI error

func (*ATMICtx) TpClose

func (ac *ATMICtx) TpClose() ATMIError

Close XA Sub-system @return ATMI Error

func (*ATMICtx) TpCommit

func (ac *ATMICtx) TpCommit(flags int64) ATMIError

Commit global transaction @param flags flags for abort operation

func (*ATMICtx) TpConnect

func (ac *ATMICtx) TpConnect(svc string, tb TypedBuffer, flags int64) (int, ATMIError)

Connect to service in conversational mode @param svc Service name @param data ATMI buffers @param flags Flags @return call descriptor (cd), ATMI error

func (*ATMICtx) TpContinue

func (ac *ATMICtx) TpContinue()

Continue main thread processing (go back to server polling)

func (*ATMICtx) TpDequeue

func (ac *ATMICtx) TpDequeue(qspace string, qname string, ctl *TPQCTL, tb TypedBuffer, flags int64) ATMIError

Dequeue message from Q @param qspace Name of the event to post @param qname ATMI buffer @param ctl Control structure @param tb Typed buffer @param flags ATMI call flags @return ATMI error

func (*ATMICtx) TpDiscon

func (ac *ATMICtx) TpDiscon(cd int) ATMIError

Disconnect from conversation @param cd Call Descriptor @return ATMI Error

func (*ATMICtx) TpEnqueue

func (ac *ATMICtx) TpEnqueue(qspace string, qname string, ctl *TPQCTL, tb TypedBuffer, flags int64) ATMIError

Enqueue message to Q @param qspace Name of the event to post @param qname ATMI buffer @param ctl Control structure @param tb Typed buffer @param flags ATMI call flags @return ATMI error

func (*ATMICtx) TpExport

func (ac *ATMICtx) TpExport(tb TypedBuffer, flags int64) (string, ATMIError)

Export the buffer to JSON format. @param tb TypecdTyped buffer @param flags 0 (JSON text) or TPEX_STRING (export in base64 format)

func (*ATMICtx) TpExtAddB4PollCB

func (ac *ATMICtx) TpExtAddB4PollCB(cb TPB4PollCallback) ATMIError

Set periodic before poll callback func @param cb Callback function with "func(ctx *ATMICtx) int" signature @return ATMI Error

func (*ATMICtx) TpExtAddPeriodCB

func (ac *ATMICtx) TpExtAddPeriodCB(secs int, cb TPPeriodCallback) ATMIError

Set periodic poll callback function. Function is called from main service dispatcher in case if given number of seconds are elapsed. If the service is doing some work currenlty then it will not be interrupted. If the service workload was longer than period, then given period will be lost and will be serviced and next sleep period or after receiving next service call. @param secs Interval in secods between calls. This basically is number of seconds in which service will sleep and wake up. @param cb Callback function with signature: "func(ctx *ATMICtx) int". @return ATMI Error

func (*ATMICtx) TpExtAddPollerFD

func (ac *ATMICtx) TpExtAddPollerFD(fd int, events uint32, ptr1 interface{}, cb TPPollerFdCallback) ATMIError

Add custom File Descriptor (FD) to Q poller @param events Epoll events @param ptr1 Custom data block to be passed to callback func @param cb Callback func @return ATMI Error

func (*ATMICtx) TpExtDelB4PollCB

func (ac *ATMICtx) TpExtDelB4PollCB() ATMIError

Delete before-doing-poll callback @return ATMI Error

func (*ATMICtx) TpExtDelPeriodCB

func (ac *ATMICtx) TpExtDelPeriodCB() ATMIError

Delete del periodic callback @return ATMI Error

func (*ATMICtx) TpExtDelPollerFD

func (ac *ATMICtx) TpExtDelPollerFD(fd int) ATMIError

Remove the polling file descriptor @param fd FD to poll on @return ATMI Error

func (*ATMICtx) TpForward

func (ac *ATMICtx) TpForward(svc string, tb TypedBuffer, flags int64)

Forward the call to specified poller and return to Q poller @param svc Service name to forward the call to @param data ATMI buffer @param flags Flags

func (*ATMICtx) TpFree

func (ac *ATMICtx) TpFree(buf *ATMIBuf)

Free the ATMI buffer @param buf ATMI buffer

func (*ATMICtx) TpGetLev

func (ac *ATMICtx) TpGetLev() int

Check are we in globa transaction? @return 0 - not in global Tx, 1 - in global Tx

func (*ATMICtx) TpGetRply

func (ac *ATMICtx) TpGetRply(cd *int, tb TypedBuffer, flags int64) (int, ATMIError)

Get async call reply @param cd call @param buf ATMI buffer @param flags call flags

func (*ATMICtx) TpGetSrvId

func (ac *ATMICtx) TpGetSrvId() int

Return server id @return server_id

func (*ATMICtx) TpGetnodeId

func (ac *ATMICtx) TpGetnodeId() int64

Get cluster node id @return Node Id

func (*ATMICtx) TpImport

func (ac *ATMICtx) TpImport(jsondata string, tb TypedBuffer, flags int64) ATMIError

Import the UBF buffer from the json string which is exported by TpExport The tb TypedBuffer will be updated according to incoming data @param jsondata json string data according to texport(3) @param tb typed buffer where to install the incoming buffer @param flags TPEX_STRING if decode as base64, TPEX_NOCHANGE do not change tb format

if buffer type is different

func (*ATMICtx) TpInit

func (ac *ATMICtx) TpInit() ATMIError

Initialize client @return ATMI Error

func (*ATMICtx) TpJSONToVIEW

func (ac *ATMICtx) TpJSONToVIEW(buffer string) (*TypedVIEW, ATMIError)

Converts string JSON buffer passed in 'buffer' to VIEW buffer. This function will automatically allocate new VIEW buffer. See tpjsontoview(3) C call for more information. @param buffer String buffer containing JSON message. The format must be one level JSON containing UBF_FIELD:Value. The value can be array, then it is loaded into occurrences. @return Typed view if parsed ok, or ATMI error

func (*ATMICtx) TpLog

func (ac *ATMICtx) TpLog(lev int, format string, a ...interface{})

Log the message to Enduro/X loggers (see tplog(3) manpage) @param lev Logging level @param a arguemnts for sprintf @param format Format string for loggers

func (*ATMICtx) TpLogAlways

func (ac *ATMICtx) TpLogAlways(format string, a ...interface{})

Log the message to Enduro/X loggers (see tplog(3) manpage) Fatal/Always level wrapper @param a arguemnts for sprintf @param format Format string for loggers

func (*ATMICtx) TpLogCloseReqFile

func (ac *ATMICtx) TpLogCloseReqFile()

Close request logger (see tplogclosereqfile(3) manpage)

func (*ATMICtx) TpLogCloseThread

func (ac *ATMICtx) TpLogCloseThread()

Close request logger (see tplogclosethread(3) manpage)

func (*ATMICtx) TpLogConfig

func (ac *ATMICtx) TpLogConfig(logger int, lev int, debug_string string, module string, new_file string) NSTDError

Configure Enduro/X logger (see tplogconfig(3) manpage) @param logger is bitwise 'ored' (see LOG_FACILITY_*) @param lev is optional (if not set: -1), log level to be assigned to facilites @param debug_string optional Enduro/X debug string (see ndrxdebug.conf(5) manpage) @param new_file optional (if not set - empty string) logging output file, overrides debug_string file tag @return NSTDError - standard library error

func (*ATMICtx) TpLogDebug

func (ac *ATMICtx) TpLogDebug(format string, a ...interface{})

Log the message to Enduro/X loggers (see tplog(3) manpage) Debug level wrapper @param a arguemnts for sprintf @param format Format string for loggers

func (*ATMICtx) TpLogDelBufReqFile

func (ac *ATMICtx) TpLogDelBufReqFile(data TypedBuffer) ATMIError

Delete request file from UBF buffer (see tplogdelbufreqfile(3) manpage) @param data XATMI buffer, must be UBF type @return ATMI error

func (*ATMICtx) TpLogDump

func (ac *ATMICtx) TpLogDump(lev int, comment string, ptr []byte, dumplen int) ATMIError

Print the byte array buffer to Enduro/X logger (see tplogdump(3) manpage) @param lev Logging level (see LOG_* constants) @param comment Title of the buffer dump @param ptr Pointer to buffer for dump @param dumplen Length of the bytes to dump @return atmiError (in case if invalid length we have for ptr and dumplen)

func (*ATMICtx) TpLogDumpDiff

func (ac *ATMICtx) TpLogDumpDiff(lev int, comment string, ptr1 []byte, ptr2 []byte, difflen int) ATMIError

Function compares to byte array buffers and prints the differences to Enduro/X logger (see tplogdumpdiff(3) manpage) @param lev Logging level (see LOG_* constants) @param comment Title of the buffer diff @param ptr1 Pointer to buffer1 for compare @param ptr2 Pointer to buffer2 for compare @param difflen Length of the bytes to compare @return atmiError (in case if invalid length we have for ptr1/ptr2 and difflen)

func (*ATMICtx) TpLogError

func (ac *ATMICtx) TpLogError(format string, a ...interface{})

Log the message to Enduro/X loggers (see tplog(3) manpage) Error level wrapper @param a arguemnts for sprintf @param format Format string for loggers

func (*ATMICtx) TpLogFatal

func (ac *ATMICtx) TpLogFatal(format string, a ...interface{})

Log the message to Enduro/X loggers (see tplog(3) manpage) Fatal/Always level wrapper @param a arguemnts for sprintf @param format Format string for loggers

func (*ATMICtx) TpLogGetBufReqFile

func (ac *ATMICtx) TpLogGetBufReqFile(data TypedBuffer) (string, ATMIError)

Get the request file name from UBF buffer (see tploggetbufreqfile(3) manpage) @param data XATMI buffer (must be UBF) @return file name, ATMI error

func (*ATMICtx) TpLogGetIflags

func (ac *ATMICtx) TpLogGetIflags() string

Return integration flags Well we will run it in cached mode...

func (*ATMICtx) TpLogGetReqFile

func (ac *ATMICtx) TpLogGetReqFile() (bool, string)

Return request logging file (if there is one currenlty in use) (see tploggetreqfile(3) manpage) @return Status (request logger open or not), full path to request file

func (*ATMICtx) TpLogInfo

func (ac *ATMICtx) TpLogInfo(format string, a ...interface{})

Log the message to Enduro/X loggers (see tplog(3) manpage) Info level wrapper @param a arguemnts for sprintf @param format Format string for loggers

func (*ATMICtx) TpLogSetReqFile

func (ac *ATMICtx) TpLogSetReqFile(data TypedBuffer, filename string, filesvc string) ATMIError

Set request file to log to (see tplogsetreqfile(3) manpage) @param data pointer to XATMI buffer (must be UBF, others will cause error), optional @param filename field name to set (this goes to UBF buffer too, if set), optional @param filesvc XATMI service name to call for requesting the new request file name, optional @return ATMI error

func (*ATMICtx) TpLogSetReqFileDirect

func (ac *ATMICtx) TpLogSetReqFileDirect(filename string)

Set request logging file, direct version (see tplogsetreqfile_direct(3) manpage) Which does operate with thread local storage If fails to open request logging file, it will automatically fall-back to stderr. @param filename Set file name to perform logging to

func (*ATMICtx) TpLogWarn

func (ac *ATMICtx) TpLogWarn(format string, a ...interface{})

Log the message to Enduro/X loggers (see tplog(3) manpage) Warning level wrapper @param a arguemnts for sprintf @param format Format string for loggers

func (*ATMICtx) TpOpen

func (ac *ATMICtx) TpOpen() ATMIError

Open XA Sub-system @return ATMI Error

func (*ATMICtx) TpPost

func (ac *ATMICtx) TpPost(eventname string, tb TypedBuffer, len int64, flags int64) (int, ATMIError)

Post the event to subscribers @param eventname Name of the event to post @param data ATMI buffer @param flags flags @return Number Of events posted, ATMI error

func (*ATMICtx) TpRecv

func (ac *ATMICtx) TpRecv(cd int, tb TypedBuffer, flags int64, revent *int64) ATMIError

Receive data from conversation @param cd call descriptor @param data ATMI buffer @param revent Return Event @return ATMI Error

func (*ATMICtx) TpResume

func (ac *ATMICtx) TpResume(tranid *TPTRANID, flags int64) ATMIError

Resume transaction NOTE! The string tranid value is platform dependent - CPU Architecture and Data Model e.g. ILP32, LP64, etc must not be mixed between suspends and resumes. @param tranid Transaction Id reference @param flags Flags for tran resume (must be 0) @return ATMI Error

func (*ATMICtx) TpResumeString

func (ac *ATMICtx) TpResumeString(tidb64 string, flags int64) ATMIError

Resume transaction, where TID is encoded in base64 string. NOTE! The string tid value is platform dependent - CPU Architecture and Data Model e.g. ILP32, LP64, etc must not be mixed. @param tidb64 Transaction Id reference (base64 encoded value) @param flags Flags for tran resume (must be 0) @return ATMI Error

func (*ATMICtx) TpReturn

func (ac *ATMICtx) TpReturn(rval int, rcode int64, tb TypedBuffer, flags int64)

Return the ATMI call and go to Q poller @param rvel Return value (TPFAIL or TPSUCCESS) @param rcode Return code (used for custom purposes) @param tb ATMI buffer @param flags Flags

func (*ATMICtx) TpRun

func (ac *ATMICtx) TpRun(initf TPSrvInitFunc, uninitf TPSrvUninitFunc) ATMIError

We should pass here init & un-init functions... So that we can start the processing @param initf callback to init function @param uninitf callback to un-init function @return Enduro/X service exit code, ATMI Error

func (*ATMICtx) TpSend

func (ac *ATMICtx) TpSend(cd int, tb TypedBuffer, flags int64, revent *int64) ATMIError

Receive data from conversation @param cd call descriptor @param data ATMI buffer @param revent Return Event @return ATMI Error

func (*ATMICtx) TpSetCallInfo

func (ac *ATMICtx) TpSetCallInfo(msg TypedBuffer, cibuf *TypedUBF, flags int64) ATMIError

Set call info, a UBF buffer assocated with call buffer @param msg Message buffer. Will return TPEINVAL error in case if this interface is nil. @param cibuf UBF buffer with message infos @param flags Shall be set to 0 @return ATMI Error

func (*ATMICtx) TpSrvFreeCtxData

func (ac *ATMICtx) TpSrvFreeCtxData(data *TPSRVCTXDATA)

Free the server context data @param data Context data block

func (*ATMICtx) TpSrvGetCtxData

func (ac *ATMICtx) TpSrvGetCtxData() (*TPSRVCTXDATA, ATMIError)

Get Server Call thread context data (free of *TPSRVCTXDATA must be done by user) @return contect data, ATMI Error

func (*ATMICtx) TpSrvSetCtxData

func (ac *ATMICtx) TpSrvSetCtxData(data *TPSRVCTXDATA, flags int64) ATMIError

Restore thread context data @return ATMI Error

func (*ATMICtx) TpSubscribe

func (ac *ATMICtx) TpSubscribe(eventexpr string, filter string, ctl *TPEVCTL, flags int64) (int64, ATMIError)

Subscribe service to some specified event @param eventexpr Subscription ID (retruned by TPSubscribe()) @param filter Event filter expression (regex) @param ctl Control struct @param flags Flags @return Subscription id, ATMI Error

func (*ATMICtx) TpSuspend

func (ac *ATMICtx) TpSuspend(tranid *TPTRANID, flags int64) ATMIError

Suspend transaction NOTE! The string tranid value is platform dependent - CPU Architecture and Data Model e.g. ILP32, LP64, etc must not be mixed between suspends and resumes. @param tranid Transaction Id reference @param flags Flags for suspend (must be 0) @return ATMI Error

func (*ATMICtx) TpSuspendString

func (ac *ATMICtx) TpSuspendString(flags int64) (string, ATMIError)

Suspend transaction, return transaction ID as base64 encoded string NOTE! The string tid value is platform dependent - CPU Architecture and Data Model e.g. ILP32, LP64, etc must not be mixed between suspends and resumes. @param flags Flags for suspend (must be 0) @return tid, ATMI Error

func (*ATMICtx) TpTerm

func (ac *ATMICtx) TpTerm() ATMIError

Terminate the client @return ATMI error

func (*ATMICtx) TpTypes

func (ac *ATMICtx) TpTypes(ptr *ATMIBuf, itype *string, subtype *string) (int64, ATMIError)

Return ATMI buffer info @param ptr Pointer to ATMI buffer @param itype ptr to string to return the buffer type (can be nil), if set then on output value will be UBF, CARRAY, STRING or JSON other buffers currently are not supported. @param subtype ptr to string to return sub-type (can be nil) @return Buffer lenght if no error or -1 if error, ATMI error

func (*ATMICtx) TpURCode

func (ac *ATMICtx) TpURCode() (int64, ATMIError)

Return user return code from last service call (i.e. value from second argument of tpreturn - rcode) @return tpurcode from ATMI context

func (*ATMICtx) TpUnadvertise

func (ac *ATMICtx) TpUnadvertise(svcname string) ATMIError

Unadvertise service dynamically @param svcname Service Name @return ATMI Error

func (*ATMICtx) TpUnsubscribe

func (ac *ATMICtx) TpUnsubscribe(subscription int64, flags int64) (int, ATMIError)

Unsubscribe from event broker @param subscription Subscription ID (retruned by TPSubscribe()) @param flags Flags @return Number of subscriptions deleted, ATMI Error

func (*ATMICtx) UBFAlloc

func (ac *ATMICtx) UBFAlloc(size int64) (TypedUBF, ATMIError)

Allocate the UBF buffer @param size Buffer size in bytes @return UBF Handler, ATMI Error

func (*ATMICtx) UserLog

func (ac *ATMICtx) UserLog(format string, a ...interface{})

Do the user logging. This prints the message to ULOG. Suitable for system wide critical message notifications @param format format string @param a list of data fields for format string

type ATMIError

type ATMIError interface {
	Error() string
	Code() int
	Message() string
}

ATMI error interface

func NewCustomATMIError

func NewCustomATMIError(code int, msg string) ATMIError

Build a custom error @param err Error buffer to build @param code Error code to setup @param msg Error message

type BFldLocInfo

type BFldLocInfo struct {
	// contains filtered or unexported fields
}

Field location infos

type BVNextState

type BVNextState struct {
	// contains filtered or unexported fields
}

State for view iterator

type ExprTree

type ExprTree struct {
	// contains filtered or unexported fields
}

Compiled Expression Tree

type NSTDError

type NSTDError interface {
	Error() string
	Code() int
	Message() string
}

NSTD error interface

func NewCustomNstdError

func NewCustomNstdError(code int, msg string) NSTDError

Build a custom error. Can be used at Go level sources To simulate standard error @param err Error buffer to build @param code Error code to setup @param msg Error message

type TPB4PollCallback

type TPB4PollCallback func(ctx *ATMICtx) int //Before poll callback

type TPEVCTL

type TPEVCTL struct {
	// contains filtered or unexported fields
}

* Event controll struct

type TPPeriodCallback

type TPPeriodCallback func(ctx *ATMICtx) int //Periodic callback

type TPPollerFdCallback

type TPPollerFdCallback func(ctx *ATMICtx, fd int, events uint32, ptr1 interface{}) int

type TPQCTL

type TPQCTL struct {
	Flags        int64             /* indicates which of the values are set */
	Deq_time     int64             /* absolute/relative  time for dequeuing */
	Priority     int64             /* enqueue priority */
	Diagnostic   int64             /* indicates reason for failure */
	Diagmsg      string            /* diagnostic message */
	Msgid        [TMMSGIDLEN]byte  /* id of message before which to queue */
	Corrid       [TMCORRIDLEN]byte /* correlation id used to identify message */
	Replyqueue   string            /* queue name for reply message */
	Failurequeue string            /* queue name for failure message */
	Cltid        string            /* client identifier for originating client */
	Urcode       int64             /* application user-return code */
	Appkey       int64             /* application authentication client key */
	Delivery_qos int64             /* delivery quality of service  */
	Reply_qos    int64             /* reply message quality of service  */
	Exp_time     int64             /* expiration time  */
}

* Queue control structure

type TPSRVCTXDATA

type TPSRVCTXDATA struct {
	// contains filtered or unexported fields
}

* Server context data (used for server's main thread * switching taks to worker thread)

type TPSVCINFO

type TPSVCINFO struct {
	Name   string   /* Service name */
	Data   ATMIBuf  /* Buffer type */
	Flags  int64    /* Flags used for service invation */
	Cd     int      /* Call descriptor (generated by client) */
	Cltid  string   /* Client ID string - full client queue name */
	Appkey int64    /* RFU */
	Fname  string   /* Function name invoked (set at TpAdvertise second param) */
	Ctx    *ATMICtx /* ATMI Server Context */
}

Servic call info

type TPServiceFunction

type TPServiceFunction func(ctx *ATMICtx, svc *TPSVCINFO)

type TPSrvInitFunc

type TPSrvInitFunc func(ctx *ATMICtx) int //TODO: Add parsed args after --

Callback defintions:

type TPSrvUninitFunc

type TPSrvUninitFunc func(ctx *ATMICtx)

type TPTRANID

type TPTRANID struct {
	// contains filtered or unexported fields
}

* Transaction ID type

type TypedBuffer

type TypedBuffer interface {
	GetBuf() *ATMIBuf
}

Base interface for typed buffer

type TypedCarray

type TypedCarray struct {
	Buf *ATMIBuf
}

UBF Buffer

func (*TypedCarray) GetBuf

func (u *TypedCarray) GetBuf() *ATMIBuf

Return The ATMI buffer to caller

func (*TypedCarray) GetBytes

func (s *TypedCarray) GetBytes() []byte

Get the string value out from buffer @return String value

func (*TypedCarray) SetBytes

func (s *TypedCarray) SetBytes(b []byte) ATMIError

@param str String value

func (*TypedCarray) TpRealloc

func (u *TypedCarray) TpRealloc(size int64) ATMIError

type TypedJSON

type TypedJSON struct {
	Buf *ATMIBuf
}

UBF Buffer

func (*TypedJSON) GetBuf

func (u *TypedJSON) GetBuf() *ATMIBuf

Return The ATMI buffer to caller

func (*TypedJSON) GetJSON

func (j *TypedJSON) GetJSON() []byte

Get JSON bytes..

func (*TypedJSON) GetJSONText

func (j *TypedJSON) GetJSONText() string

Get the string value out from buffer @return JSON value

func (*TypedJSON) SetJSON

func (j *TypedJSON) SetJSON(b []byte) ATMIError

Set JSON bytes

func (*TypedJSON) SetJSONText

func (j *TypedJSON) SetJSONText(gs string) ATMIError

Set the string to the buffer @param str JSON value

func (*TypedJSON) TpRealloc

func (u *TypedJSON) TpRealloc(size int64) ATMIError

type TypedString

type TypedString struct {
	Buf *ATMIBuf
}

UBF Buffer

func (*TypedString) GetBuf

func (u *TypedString) GetBuf() *ATMIBuf

Return The ATMI buffer to caller

func (*TypedString) GetString

func (s *TypedString) GetString() string

Get the string value out from buffer @return String value

func (*TypedString) SetString

func (s *TypedString) SetString(gs string) ATMIError

Set the string to the buffer @param str String value

func (*TypedString) TpRealloc

func (u *TypedString) TpRealloc(size int64) ATMIError

type TypedUBF

type TypedUBF struct {
	Buf *ATMIBuf
}

UBF Buffer

func (*TypedUBF) BAdd

func (u *TypedUBF) BAdd(bfldid int, ival interface{}) UBFError

Add field to buffer @param bfldid Field ID @param ival Input value @return UBF Error

func (*TypedUBF) BAddFast

func (u *TypedUBF) BAddFast(bfldid int, ival interface{}, loc *BFldLocInfo, first bool) UBFError

Fast add of filed to buffer (assuming buffer not changed and adding the same type of field. NOTE ! Types must be matched with UBF field type @param bfldid field id to add @param ival value to add @param loc location data (last saved or new data) - initialized by first flag @param first set to true, if 'loc' is not inialised @return UBF error or nil

func (*TypedUBF) BBoolEv

func (u *TypedUBF) BBoolEv(tree *ExprTree) bool

Test the expresion tree to current UBF buffer @param tree compiled expression tree @return true (buffer matched expression) or false (buffer not matched expression)

func (*TypedUBF) BChg

func (u *TypedUBF) BChg(bfldid int, occ int, ival interface{}) UBFError

Change field in buffer @param bfldid Field ID @param ival Input value @return UBF Error

func (*TypedUBF) BChgCombined

func (u *TypedUBF) BChgCombined(bfldid int, occ int, ival interface{}, do_add bool) UBFError

Set the field value. Combined supports change (chg) or add mode @param bfldid Field ID @param occ Field Occurrance @param ival Input value @param do_add Adding mode true = add, false = change @return UBF Error

func (*TypedUBF) BDel

func (u *TypedUBF) BDel(bfldid int, occ int) UBFError

Delete the field from buffer @param fldid Field ID @param occ Field occurance @return UBF error

func (*TypedUBF) BDelAll

func (u *TypedUBF) BDelAll(bfldid int) UBFError

Delete field (all occurrances) from buffer @param bfldid field ID @return UBF error

func (*TypedUBF) BDelete

func (u *TypedUBF) BDelete(fldlist []int) UBFError

Delete listed fields from UBF buffer @param fldlist list of fields (array) @return UBF error

func (*TypedUBF) BExtRead

func (u *TypedUBF) BExtRead(s string) UBFError

Read the bufer content from string @param s String buffer representation @return UBF error

func (*TypedUBF) BFloatEv

func (u *TypedUBF) BFloatEv(tree *ExprTree) float64

Evalute expression value in float64 format @param tree compiled expression tree @return expression value

func (*TypedUBF) BGet

func (u *TypedUBF) BGet(bfldid int, occ int) (interface{}, UBFError)

Get the field form buffer. This returns the interface to underlaying type @param bfldid Field ID @param occ Occurrance @return interface to value, UBF error

func (*TypedUBF) BGetByte

func (u *TypedUBF) BGetByte(bfldid int, occ int) (byte, UBFError)

Return byte (c char) value from buffer @param bfldid Field ID @param occ Occurrance @return byte val, UBF error

func (*TypedUBF) BGetByteArr

func (u *TypedUBF) BGetByteArr(bfldid int, occ int) ([]byte, UBFError)

Get string value @param bfldid Field ID @param occ Occurrance @return string val, UBF error

func (*TypedUBF) BGetFloat32

func (u *TypedUBF) BGetFloat32(bfldid int, occ int) (float32, UBFError)

Get float value from UBF buffer, see CBget(3) @param bfldid Field ID @param occ Occurrance @return float, UBF error

func (*TypedUBF) BGetFloat64

func (u *TypedUBF) BGetFloat64(bfldid int, occ int) (float64, UBFError)

Get double value @param bfldid Field ID @param occ Occurrance @return double, UBF error

func (*TypedUBF) BGetInt

func (u *TypedUBF) BGetInt(bfldid int, occ int) (int, UBFError)

Return int (basicaly C long (int64) casted to) value from buffer @param bfldid Field ID @param occ Occurrance @return int64 val, UBF error

func (*TypedUBF) BGetInt16

func (u *TypedUBF) BGetInt16(bfldid int, occ int) (int16, UBFError)

Return int16 value from buffer @param bfldid Field ID @param occ Occurrance @return int16 val, UBF error

func (*TypedUBF) BGetInt64

func (u *TypedUBF) BGetInt64(bfldid int, occ int) (int64, UBFError)

Return int64 value from buffer @param bfldid Field ID @param occ Occurrance @return int64 val, UBF error

func (*TypedUBF) BGetString

func (u *TypedUBF) BGetString(bfldid int, occ int) (string, UBFError)

Get string value @param bfldid Field ID @param occ Occurrance @return string val, UBF error

func (*TypedUBF) BIsUBF

func (u *TypedUBF) BIsUBF() bool

Test C buffer for UBF format @return TRUE - buffer is UBF, FALSE - not UBF

func (*TypedUBF) BLen

func (u *TypedUBF) BLen(bfldid int, occ int) (int, UBFError)

Get the field len @param fldid Field ID @param occ Field occurance @return FIeld len, UBF error

func (*TypedUBF) BNext

func (u *TypedUBF) BNext(first bool) (int, int, UBFError)

Iterate over the buffer NOTE: This is not multiple context safe. It stores iteration state internally @param first TRUE start iteration, FALSE continue iteration @return Field ID, Field Occurrance, UBF Error

func (*TypedUBF) BOccur

func (u *TypedUBF) BOccur(bfldid int) (int, UBFError)

Get the number of field occurrances in buffer @param bfldid Field ID @return count (or -1 on error), UBF error

func (*TypedUBF) BPres

func (u *TypedUBF) BPres(bfldid int, occ int) bool

Check for field presence in buffer @param fldid Field ID @param occ Field occurance @return true/false present/not present

func (*TypedUBF) BPrint

func (u *TypedUBF) BPrint() UBFError

Print the buffer to stdout @return UBF error

func (*TypedUBF) BProj

func (u *TypedUBF) BProj(fldlist []int) UBFError

Make a project copy of the fields (leave only those in array) @return UBF error

func (*TypedUBF) BQBoolEv

func (u *TypedUBF) BQBoolEv(expr string) (bool, UBFError)

Quick eval of the expression (compiles & frees the handler automatically) @param expr Expression tree @return result: true or false, UBF error

func (*TypedUBF) BRead

func (u *TypedUBF) BRead(dump []byte) UBFError

Serialize the UBF buffer @return serialized bytes, UBF error

func (*TypedUBF) BSizeof

func (u *TypedUBF) BSizeof() (int64, UBFError)

Get the total buffer size @return bufer size, UBF error

func (*TypedUBF) BSprint

func (u *TypedUBF) BSprint() (string, UBFError)

Print UBF buffer to string. The output string buffer at C side is composed as UBF buffer size of multiplied by MAXTIDENT (currently 30). The total size is used for purpuse so that Go developer can used extended buffer size in case if there is no free space (returned error BEUNIX) @returns BPrint format string or "" in case of error. Second argument is

UBF error set in case of error, else it is nil

func (*TypedUBF) BType

func (u *TypedUBF) BType(bfldid int) (string, UBFError)

Return type descriptor of the field - string format. possible values: short, long, char, float, double, string, carray @param bfldid field ID @return field type, UBF error

func (*TypedUBF) BUnused

func (u *TypedUBF) BUnused() (int64, UBFError)

Get the number of free bytes of UBF buffer @return buffer free bytes, UBF error

func (*TypedUBF) BUsed

func (u *TypedUBF) BUsed() (int64, UBFError)

Get the number of bytes used in UBF buffer @return number of byptes used, UBF error

func (*TypedUBF) BWrite

func (u *TypedUBF) BWrite() ([]byte, UBFError)

Serialize the UBF buffer @return serialized bytes, UBF error

func (*TypedUBF) GetBuf

func (u *TypedUBF) GetBuf() *ATMIBuf

Return The ATMI buffer to caller

func (*TypedUBF) Marshal

func (u *TypedUBF) Marshal(v interface{}) UBFError

Copy the structur in v struct to UBF @param v local struct @return UBF error

func (*TypedUBF) MarshalSingle

func (u *TypedUBF) MarshalSingle(v interface{}, occ int) UBFError

Copy the structur in v struct to UBF @param v local struct @param occ single occurrence to marshal to UBF, i.e. single struct arrays occurrence

	to copy to UBF. Applies only to structure array elements. In case of occurrence
 is set which is out of the bounds of the array, the error will be generated as
	BEINVAL

@return UBF error

func (*TypedUBF) TpJSONToUBF

func (u *TypedUBF) TpJSONToUBF(buffer string) UBFError

Converts string JSON buffer passed in 'buffer' to UBF buffer. This function will automatically allocate the free space in UBF to fit the JSON. The size will be determinated by string length. See tpjsontoubf(3) C call for more information. @param buffer String buffer containing JSON message. The format must be one level JSON containing UBF_FIELD:Value. The value can be array, then it is loaded into occurrences. @return UBFError ('BEINVAL' if failed to convert, 'BMALLOC' if buffer resize failed)

func (*TypedUBF) TpLogPrintUBF

func (u *TypedUBF) TpLogPrintUBF(lev int, title string)

Print the buffer to stdout @return UBF error

func (*TypedUBF) TpRealloc

func (u *TypedUBF) TpRealloc(size int64) ATMIError

func (*TypedUBF) TpUBFToJSON

func (u *TypedUBF) TpUBFToJSON() (string, ATMIError)

Convert given UBF buffer to JSON block, see tpubftojson(3) C call Output string is automatically allocated @return JSON string (if converted ok), ATMIError in case of failure. More detailed infos in case of error is found in 'ubf' and 'ndrx' facility logs.

func (*TypedUBF) Unmarshal

func (u *TypedUBF) Unmarshal(v interface{}) UBFError

Copy the specified fields to the local structure according to the `ubf' (i.e. take fields from UBF and copy to v structure). @param v local struct @return UBF error

func (*TypedUBF) UnmarshalSingle

func (u *TypedUBF) UnmarshalSingle(v interface{}, occ int) UBFError

Copy the specified fields to the local structure according to the `ubf' (i.e. take fields from UBF and copy to v structure). @param v local struct @param occ single occurrence in UBF to copy to either simple structure elements

or array elements. If copied to array, then it goes to first array element.

@return UBF error

type TypedVIEW

type TypedVIEW struct {
	Buf *ATMIBuf
	// contains filtered or unexported fields
}

UBF Buffer

func (*TypedVIEW) BVChg

func (u *TypedVIEW) BVChg(cname string, occ int, ival interface{}) UBFError

Set view field value. See CBvchg(3). @param cname C field name of view @param occ Occurrance to set @param ival Value to set to. Note that given field is automatically converted to specified typed in view with best possible converstion @return byte array val, UBF error

func (*TypedVIEW) BVCpy

func (u *TypedVIEW) BVCpy(dst *TypedVIEW) (int64, UBFError)

Copy view content to another view @param dst destination view to copy to, must be atleast in size of view @return bytes copied, UBF error (or nil)

func (*TypedVIEW) BVGetByte

func (u *TypedVIEW) BVGetByte(cname string, occ int, flags int64) (byte, UBFError)

Return Byte (char) value from view field. See CBvget(3). @param cname C field name for view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return signle byte val, UBF error

func (*TypedVIEW) BVGetByteArr

func (u *TypedVIEW) BVGetByteArr(cname string, occ int, flags int64) ([]byte, UBFError)

Return carray/byte array BLOB value from view field. See CBvget(3). @param cname C field name of view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return byte array val, UBF error

func (*TypedVIEW) BVGetFloat32

func (u *TypedVIEW) BVGetFloat32(cname string, occ int, flags int64) (float32, UBFError)

Return float value from view field. See CBvget(3). @param cname C field name for view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return float val, UBF error

func (*TypedVIEW) BVGetFloat64

func (u *TypedVIEW) BVGetFloat64(cname string, occ int, flags int64) (float64, UBFError)

Return double value from view field. See CBvget(3). @param cname C field name for view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return double val, UBF error

func (*TypedVIEW) BVGetInt

func (u *TypedVIEW) BVGetInt(cname string, occ int, flags int64) (int, UBFError)

Return int value from view field. See CBvget(3). @param cname C field name for view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return int val, UBF error

func (*TypedVIEW) BVGetInt16

func (u *TypedVIEW) BVGetInt16(cname string, occ int, flags int64) (int16, UBFError)

Return int16 value from view field. See CBvget(3). @param cname C field name for view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return int16 val, UBF error

func (*TypedVIEW) BVGetInt64

func (u *TypedVIEW) BVGetInt64(cname string, occ int, flags int64) (int64, UBFError)

Return int64 value from view field. See CBvget(3). @param cname C field name for view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return int64 val, UBF error

func (*TypedVIEW) BVGetString

func (u *TypedVIEW) BVGetString(cname string, occ int, flags int64) (string, UBFError)

Return string value from view field. See CBvget(3). @param cname C field name of view @param occ Occurrance @param flags BVACCESS_NOTNULL (do not return NULL value defined in view but report as BNOTPRES error instead) or 0 (returns NULL values if view field is set to) @return string val, UBF error

func (*TypedVIEW) BVName

func (u *TypedVIEW) BVName() string

Return view name @return view name

func (*TypedVIEW) BVNext

func (u *TypedVIEW) BVNext(state *BVNextState, start bool) (int, string, int, int, int64, UBFError)

Iterate over the view structure - return structure fields and field infos. When starting to iterate, "start" field must be set to true, when continue to iterate the, the start must be set to false. In case if field is found, the first return value (ret) will be set to 1, if EOF is reached, then ret is set to 0. If error occurs, the ret is set to -1 and UBFError is set @param state object value to keep the state of the iteration @param start true - if start to iterate, false - if continue to iterate @return ret (status -1: fail, 0: EOF, 1: Got field), cname (field name), fldtyp (BFLD_* type), maxocc (Max occurrences), dim_size (field size in bytes), UBF Error if have err

func (*TypedVIEW) BVOccur

func (u *TypedVIEW) BVOccur(cname string) (int, int, int, int64, int, UBFError)

Get view field information, occurrences and related infos. See Bvoccur(3) C manpage for more infos. @param cname view field name @return ret (number of "C" set occs), maxocc (max occurrences fo field), realocc (real non NULL occurrences measuring from array end), dim_size (number of bytes stored in field (at C level)), fldtype (Field type, see BFLD_*), errU (UBF error if set)

func (*TypedVIEW) BVSetOccur

func (u *TypedVIEW) BVSetOccur(cname string, occ int) UBFError

Set number number of occurrences in "C_<field>" field, if "C" flag defined in view. If flag not defined, then call succeeds but value is ignored. See Bvsetoccur(3). @return UBF error in case of error (nil on SUCCEED)

func (*TypedVIEW) BVSizeof

func (u *TypedVIEW) BVSizeof() (int64, UBFError)

Get structure size in bytes for given TypedVIEW object. See Bvsizeof(3). @return ret (number of view bytes (if no error)), UBFError in case of error

func (*TypedVIEW) GetBuf

func (u *TypedVIEW) GetBuf() *ATMIBuf

Return The ATMI buffer to caller

func (*TypedVIEW) TpRealloc

func (v *TypedVIEW) TpRealloc(size int64) ATMIError

func (*TypedVIEW) TpVIEWToJSON

func (u *TypedVIEW) TpVIEWToJSON(flags int64) (string, ATMIError)

Convert given VIEW buffer to JSON block, see tpviewtojson(3) C call Output string is automatically allocated @return JSON string (if converted ok), ATMIError in case of failure.

type UBFError

type UBFError interface {
	Error() string
	Code() int
	Message() string
}

ATMI error interface

func NewCustomUBFError

func NewCustomUBFError(code int, msg string) UBFError

Build a custom error @param err Error buffer to build @param code Error code to setup @param msg Error message

type UBFExprFunc

type UBFExprFunc func(buf *TypedUBF, funcname string) int64

///////////////////////////////////////////////////////////////////////////////// Globals /////////////////////////////////////////////////////////////////////////////////

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL