Skip to content

Commit

Permalink
core: adjust System.Storage.PutEx interop
Browse files Browse the repository at this point in the history
Part of #1055.

Added System.Storage.PutEx to compiler.
  • Loading branch information
AnnaShaleva committed Jul 22, 2020
1 parent 47eadcd commit 56a2b8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/compiler/syscall.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ var syscalls = map[string]map[string]Syscall{
"GetContext": {"System.Storage.GetContext", false},
"GetReadOnlyContext": {"System.Storage.GetReadOnlyContext", false},
"Put": {"System.Storage.Put", false},
"PutEx": {"System.Storage.PutEx", false},
},
}
7 changes: 7 additions & 0 deletions pkg/interop/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ func GetReadOnlyContext() Context { return Context{} }
// runtime.Serialize. This function uses `System.Storage.Put` syscall.
func Put(ctx Context, key interface{}, value interface{}) {}

// PutEx is an advanced version of Put which saves given value with given key
// and given ReadOnly flag in the storage using given Context. `flag` argument
// can either be 1 for constant storage items or 0 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) {}

// Get retrieves value stored for the given key using given Context. See Put
// documentation on possible key and value types. If the value is not present in
// the database it returns nil. This function uses `System.Storage.Get` syscall.
Expand Down

0 comments on commit 56a2b8f

Please sign in to comment.