From 1138143a504a6c3b3039c907001c5a649e46cbe9 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Thu, 4 Mar 2021 13:13:12 +0300 Subject: [PATCH] compiler/interop: add flag type for `PutEx` --- pkg/interop/storage/storage.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/interop/storage/storage.go b/pkg/interop/storage/storage.go index 5526aa96f..c9775ebfa 100644 --- a/pkg/interop/storage/storage.go +++ b/pkg/interop/storage/storage.go @@ -38,6 +38,16 @@ const ( PickField1 FindFlags = 1 << 5 ) +// PutFlags represents flag of `PutEx` syscall. +type PutFlags byte + +const ( + // PutDefault is a storage flag for non-constant items. + PutDefault PutFlags = 0 + // PutConstant is a storage flag for constant items. + PutConstant PutFlags = 0x01 +) + // ConvertContextToReadOnly returns new context from the given one, but with // writing capability turned off, so that you could only invoke Get and Find // using this new Context. If Context is already read-only this function is a @@ -74,7 +84,7 @@ func Put(ctx Context, key interface{}, value interface{}) { // can either be odd for constant storage items or even for variable storage items. // Refer to Put function description for details on how to pass the remaining // arguments. This function uses `System.Storage.PutEx` syscall. -func PutEx(ctx Context, key interface{}, value interface{}, flag int64) { +func PutEx(ctx Context, key interface{}, value interface{}, flag PutFlags) { neogointernal.Syscall4NoReturn("System.Storage.PutEx", ctx, key, value, flag) }