github.com/ydb-platform/ydb-go-sdk/v3@v3.89.2/trace/scheme_gtrace.go (about)

     1  // Code generated by gtrace. DO NOT EDIT.
     2  
     3  package trace
     4  
     5  import (
     6  	"context"
     7  )
     8  
     9  // schemeComposeOptions is a holder of options
    10  type schemeComposeOptions struct {
    11  	panicCallback func(e interface{})
    12  }
    13  
    14  // SchemeOption specified Scheme compose option
    15  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
    16  type SchemeComposeOption func(o *schemeComposeOptions)
    17  
    18  // WithSchemePanicCallback specified behavior on panic
    19  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
    20  func WithSchemePanicCallback(cb func(e interface{})) SchemeComposeOption {
    21  	return func(o *schemeComposeOptions) {
    22  		o.panicCallback = cb
    23  	}
    24  }
    25  
    26  // Compose returns a new Scheme which has functional fields composed both from t and x.
    27  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
    28  func (t *Scheme) Compose(x *Scheme, opts ...SchemeComposeOption) *Scheme {
    29  	if t == nil {
    30  		return x
    31  	}
    32  	var ret Scheme
    33  	options := schemeComposeOptions{}
    34  	for _, opt := range opts {
    35  		if opt != nil {
    36  			opt(&options)
    37  		}
    38  	}
    39  	{
    40  		h1 := t.OnListDirectory
    41  		h2 := x.OnListDirectory
    42  		ret.OnListDirectory = func(s SchemeListDirectoryStartInfo) func(SchemeListDirectoryDoneInfo) {
    43  			if options.panicCallback != nil {
    44  				defer func() {
    45  					if e := recover(); e != nil {
    46  						options.panicCallback(e)
    47  					}
    48  				}()
    49  			}
    50  			var r, r1 func(SchemeListDirectoryDoneInfo)
    51  			if h1 != nil {
    52  				r = h1(s)
    53  			}
    54  			if h2 != nil {
    55  				r1 = h2(s)
    56  			}
    57  			return func(s SchemeListDirectoryDoneInfo) {
    58  				if options.panicCallback != nil {
    59  					defer func() {
    60  						if e := recover(); e != nil {
    61  							options.panicCallback(e)
    62  						}
    63  					}()
    64  				}
    65  				if r != nil {
    66  					r(s)
    67  				}
    68  				if r1 != nil {
    69  					r1(s)
    70  				}
    71  			}
    72  		}
    73  	}
    74  	{
    75  		h1 := t.OnDescribePath
    76  		h2 := x.OnDescribePath
    77  		ret.OnDescribePath = func(s SchemeDescribePathStartInfo) func(SchemeDescribePathDoneInfo) {
    78  			if options.panicCallback != nil {
    79  				defer func() {
    80  					if e := recover(); e != nil {
    81  						options.panicCallback(e)
    82  					}
    83  				}()
    84  			}
    85  			var r, r1 func(SchemeDescribePathDoneInfo)
    86  			if h1 != nil {
    87  				r = h1(s)
    88  			}
    89  			if h2 != nil {
    90  				r1 = h2(s)
    91  			}
    92  			return func(s SchemeDescribePathDoneInfo) {
    93  				if options.panicCallback != nil {
    94  					defer func() {
    95  						if e := recover(); e != nil {
    96  							options.panicCallback(e)
    97  						}
    98  					}()
    99  				}
   100  				if r != nil {
   101  					r(s)
   102  				}
   103  				if r1 != nil {
   104  					r1(s)
   105  				}
   106  			}
   107  		}
   108  	}
   109  	{
   110  		h1 := t.OnMakeDirectory
   111  		h2 := x.OnMakeDirectory
   112  		ret.OnMakeDirectory = func(s SchemeMakeDirectoryStartInfo) func(SchemeMakeDirectoryDoneInfo) {
   113  			if options.panicCallback != nil {
   114  				defer func() {
   115  					if e := recover(); e != nil {
   116  						options.panicCallback(e)
   117  					}
   118  				}()
   119  			}
   120  			var r, r1 func(SchemeMakeDirectoryDoneInfo)
   121  			if h1 != nil {
   122  				r = h1(s)
   123  			}
   124  			if h2 != nil {
   125  				r1 = h2(s)
   126  			}
   127  			return func(s SchemeMakeDirectoryDoneInfo) {
   128  				if options.panicCallback != nil {
   129  					defer func() {
   130  						if e := recover(); e != nil {
   131  							options.panicCallback(e)
   132  						}
   133  					}()
   134  				}
   135  				if r != nil {
   136  					r(s)
   137  				}
   138  				if r1 != nil {
   139  					r1(s)
   140  				}
   141  			}
   142  		}
   143  	}
   144  	{
   145  		h1 := t.OnRemoveDirectory
   146  		h2 := x.OnRemoveDirectory
   147  		ret.OnRemoveDirectory = func(s SchemeRemoveDirectoryStartInfo) func(SchemeRemoveDirectoryDoneInfo) {
   148  			if options.panicCallback != nil {
   149  				defer func() {
   150  					if e := recover(); e != nil {
   151  						options.panicCallback(e)
   152  					}
   153  				}()
   154  			}
   155  			var r, r1 func(SchemeRemoveDirectoryDoneInfo)
   156  			if h1 != nil {
   157  				r = h1(s)
   158  			}
   159  			if h2 != nil {
   160  				r1 = h2(s)
   161  			}
   162  			return func(s SchemeRemoveDirectoryDoneInfo) {
   163  				if options.panicCallback != nil {
   164  					defer func() {
   165  						if e := recover(); e != nil {
   166  							options.panicCallback(e)
   167  						}
   168  					}()
   169  				}
   170  				if r != nil {
   171  					r(s)
   172  				}
   173  				if r1 != nil {
   174  					r1(s)
   175  				}
   176  			}
   177  		}
   178  	}
   179  	{
   180  		h1 := t.OnModifyPermissions
   181  		h2 := x.OnModifyPermissions
   182  		ret.OnModifyPermissions = func(s SchemeModifyPermissionsStartInfo) func(SchemeModifyPermissionsDoneInfo) {
   183  			if options.panicCallback != nil {
   184  				defer func() {
   185  					if e := recover(); e != nil {
   186  						options.panicCallback(e)
   187  					}
   188  				}()
   189  			}
   190  			var r, r1 func(SchemeModifyPermissionsDoneInfo)
   191  			if h1 != nil {
   192  				r = h1(s)
   193  			}
   194  			if h2 != nil {
   195  				r1 = h2(s)
   196  			}
   197  			return func(s SchemeModifyPermissionsDoneInfo) {
   198  				if options.panicCallback != nil {
   199  					defer func() {
   200  						if e := recover(); e != nil {
   201  							options.panicCallback(e)
   202  						}
   203  					}()
   204  				}
   205  				if r != nil {
   206  					r(s)
   207  				}
   208  				if r1 != nil {
   209  					r1(s)
   210  				}
   211  			}
   212  		}
   213  	}
   214  	return &ret
   215  }
   216  func (t *Scheme) onListDirectory(s SchemeListDirectoryStartInfo) func(SchemeListDirectoryDoneInfo) {
   217  	fn := t.OnListDirectory
   218  	if fn == nil {
   219  		return func(SchemeListDirectoryDoneInfo) {
   220  			return
   221  		}
   222  	}
   223  	res := fn(s)
   224  	if res == nil {
   225  		return func(SchemeListDirectoryDoneInfo) {
   226  			return
   227  		}
   228  	}
   229  	return res
   230  }
   231  func (t *Scheme) onDescribePath(s SchemeDescribePathStartInfo) func(SchemeDescribePathDoneInfo) {
   232  	fn := t.OnDescribePath
   233  	if fn == nil {
   234  		return func(SchemeDescribePathDoneInfo) {
   235  			return
   236  		}
   237  	}
   238  	res := fn(s)
   239  	if res == nil {
   240  		return func(SchemeDescribePathDoneInfo) {
   241  			return
   242  		}
   243  	}
   244  	return res
   245  }
   246  func (t *Scheme) onMakeDirectory(s SchemeMakeDirectoryStartInfo) func(SchemeMakeDirectoryDoneInfo) {
   247  	fn := t.OnMakeDirectory
   248  	if fn == nil {
   249  		return func(SchemeMakeDirectoryDoneInfo) {
   250  			return
   251  		}
   252  	}
   253  	res := fn(s)
   254  	if res == nil {
   255  		return func(SchemeMakeDirectoryDoneInfo) {
   256  			return
   257  		}
   258  	}
   259  	return res
   260  }
   261  func (t *Scheme) onRemoveDirectory(s SchemeRemoveDirectoryStartInfo) func(SchemeRemoveDirectoryDoneInfo) {
   262  	fn := t.OnRemoveDirectory
   263  	if fn == nil {
   264  		return func(SchemeRemoveDirectoryDoneInfo) {
   265  			return
   266  		}
   267  	}
   268  	res := fn(s)
   269  	if res == nil {
   270  		return func(SchemeRemoveDirectoryDoneInfo) {
   271  			return
   272  		}
   273  	}
   274  	return res
   275  }
   276  func (t *Scheme) onModifyPermissions(s SchemeModifyPermissionsStartInfo) func(SchemeModifyPermissionsDoneInfo) {
   277  	fn := t.OnModifyPermissions
   278  	if fn == nil {
   279  		return func(SchemeModifyPermissionsDoneInfo) {
   280  			return
   281  		}
   282  	}
   283  	res := fn(s)
   284  	if res == nil {
   285  		return func(SchemeModifyPermissionsDoneInfo) {
   286  			return
   287  		}
   288  	}
   289  	return res
   290  }
   291  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
   292  func SchemeOnListDirectory(t *Scheme, c *context.Context, call call) func(error) {
   293  	var p SchemeListDirectoryStartInfo
   294  	p.Context = c
   295  	p.Call = call
   296  	res := t.onListDirectory(p)
   297  	return func(e error) {
   298  		var p SchemeListDirectoryDoneInfo
   299  		p.Error = e
   300  		res(p)
   301  	}
   302  }
   303  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
   304  func SchemeOnDescribePath(t *Scheme, c *context.Context, call call, path string) func(entryType string, _ error) {
   305  	var p SchemeDescribePathStartInfo
   306  	p.Context = c
   307  	p.Call = call
   308  	p.Path = path
   309  	res := t.onDescribePath(p)
   310  	return func(entryType string, e error) {
   311  		var p SchemeDescribePathDoneInfo
   312  		p.EntryType = entryType
   313  		p.Error = e
   314  		res(p)
   315  	}
   316  }
   317  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
   318  func SchemeOnMakeDirectory(t *Scheme, c *context.Context, call call, path string) func(error) {
   319  	var p SchemeMakeDirectoryStartInfo
   320  	p.Context = c
   321  	p.Call = call
   322  	p.Path = path
   323  	res := t.onMakeDirectory(p)
   324  	return func(e error) {
   325  		var p SchemeMakeDirectoryDoneInfo
   326  		p.Error = e
   327  		res(p)
   328  	}
   329  }
   330  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
   331  func SchemeOnRemoveDirectory(t *Scheme, c *context.Context, call call, path string) func(error) {
   332  	var p SchemeRemoveDirectoryStartInfo
   333  	p.Context = c
   334  	p.Call = call
   335  	p.Path = path
   336  	res := t.onRemoveDirectory(p)
   337  	return func(e error) {
   338  		var p SchemeRemoveDirectoryDoneInfo
   339  		p.Error = e
   340  		res(p)
   341  	}
   342  }
   343  // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals
   344  func SchemeOnModifyPermissions(t *Scheme, c *context.Context, call call, path string) func(error) {
   345  	var p SchemeModifyPermissionsStartInfo
   346  	p.Context = c
   347  	p.Call = call
   348  	p.Path = path
   349  	res := t.onModifyPermissions(p)
   350  	return func(e error) {
   351  		var p SchemeModifyPermissionsDoneInfo
   352  		p.Error = e
   353  		res(p)
   354  	}
   355  }