indexer

package
v0.0.0-...-4eea697 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecutionRevertedNFD = "execution reverted: NFD"
	ExecutionRevertedDNY = "execution reverted: DNY"
	ExecutionRevertedAEX = "execution reverted: AEX"
)

Variables

View Source
var (
	String, _  = abi.NewType("string", "", nil)
	Bytes32, _ = abi.NewType("bytes32", "", nil)
	Bytes, _   = abi.NewType("bytes", "", nil)
	Uint8, _   = abi.NewType("uint8", "", nil)
	Uint256, _ = abi.NewType("uint256", "", nil)
	Address, _ = abi.NewType("address", "", nil)
	Access, _  = abi.NewType("tuple", "", []abi.ArgumentMarshaling{
		{Name: "IdHash", Type: "bytes32"},
		{Name: "IdEncr", Type: "bytes"},
		{Name: "KeyEncr", Type: "bytes"},
		{Name: "Level", Type: "uint8"},
	})
	DocMeta, _ = abi.NewType("tuple", "", []abi.ArgumentMarshaling{
		{Name: "docType", Type: "uint8"},
		{Name: "status", Type: "uint8"},
		{Name: "CID", Type: "bytes"},
		{Name: "dealCID", Type: "bytes"},
		{Name: "minerAddress", Type: "bytes"},
		{Name: "docUIDEncrypted", Type: "bytes"},
		{Name: "docBaseUIDHash", Type: "bytes32"},
		{Name: "version", Type: "bytes32"},
		{Name: "isLast", Type: "bool"},
		{Name: "timestamp", Type: "uint32"},
	})
)

Functions

func Keccak256

func Keccak256(data []byte) *[32]byte

Types

type AccessObject

type AccessObject = accessStore.IAccessStoreAccess

type Index

type Index struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(ehrIndexAddr, accessStoreAddr, usersAddr, dataStoreAddr, keyPath string, client *ethclient.Client, gasTipCap int64) *Index

func (*Index) AddEhrDoc

func (i *Index) AddEhrDoc(docType types.DocumentType, docMeta *model.DocumentMeta, privKey *[32]byte) ([]byte, error)

func (*Index) DataUpdate

func (i *Index) DataUpdate(ctx context.Context, groupID, dataID, ehrID *uuid.UUID, data []byte) (string, error)

func (*Index) DeleteDoc

func (i *Index) DeleteDoc(ctx context.Context, ehrUUID *uuid.UUID, docType types.DocumentType, docBaseUIDHash, version, privKey *[32]byte) (string, error)

func (*Index) DocAccessSet

func (i *Index) DocAccessSet(ctx context.Context, CID, CIDEncr, keyEncr []byte, accessLevel uint8, userPrivKey, toUserPrivKey *[32]byte) ([]byte, error)

func (*Index) DocGroupAddDoc

func (i *Index) DocGroupAddDoc(gID *uuid.UUID, docCIDHash *[32]byte, docCIDEncr []byte, userPrivKey *[32]byte) ([]byte, error)

func (*Index) DocGroupCreate

func (i *Index) DocGroupCreate(ctx context.Context, gID *uuid.UUID, gIDEncr, gKeyEncr, gNameEncr []byte, userPrivKey *[32]byte) ([]byte, error)

func (*Index) DocGroupGetByID

func (i *Index) DocGroupGetByID(ctx context.Context, gID *uuid.UUID, userPubKey, userPrivateKey *[32]byte) (*model.DocumentGroup, error)

func (*Index) DocGroupGetDocs

func (i *Index) DocGroupGetDocs(ctx context.Context, gID *uuid.UUID) ([][]byte, error)

Returns: []CIDEncr

func (*Index) GetAccessKey

func (i *Index) GetAccessKey(ctx context.Context, userIDHash *[32]byte, kind access.Kind, accessID []byte, userPubKey, userPrivKey *[32]byte) (*chachaPoly.Key, error)

func (*Index) GetAccessList

func (i *Index) GetAccessList(ctx context.Context, IDHash *[32]byte, kind access.Kind) (access.List, error)

func (*Index) GetDocByTime

func (i *Index) GetDocByTime(ctx context.Context, ehrUUID *uuid.UUID, docType types.DocumentType, timestamp uint32) (*model.DocumentMeta, error)

func (*Index) GetDocByVersion

func (i *Index) GetDocByVersion(ctx context.Context, ehrUUID *uuid.UUID, docType types.DocumentType, docBaseUIDHash, version *[32]byte) (*model.DocumentMeta, error)

func (*Index) GetDocKeyEncrypted

func (i *Index) GetDocKeyEncrypted(ctx context.Context, userID, systemID string, CID []byte) ([]byte, error)

func (*Index) GetDocLastByBaseID

func (i *Index) GetDocLastByBaseID(ctx context.Context, userID, systemID string, docType types.DocumentType, UIDHash *[32]byte) (*model.DocumentMeta, error)

func (*Index) GetDocLastByType

func (i *Index) GetDocLastByType(ctx context.Context, ehrUUID *uuid.UUID, docType types.DocumentType) (*model.DocumentMeta, error)

func (*Index) GetEhrUUIDBySubject

func (i *Index) GetEhrUUIDBySubject(ctx context.Context, subjectID, subjectNamespace string) (*uuid.UUID, error)

func (*Index) GetEhrUUIDByUserID

func (i *Index) GetEhrUUIDByUserID(ctx context.Context, userID, systemID string) (*uuid.UUID, error)

func (*Index) GetTxStatus

func (i *Index) GetTxStatus(ctx context.Context, hash string) (uint64, error)

func (*Index) GetUser

func (i *Index) GetUser(ctx context.Context, userAddr common.Address) (*userModel.User, error)

func (*Index) GetUserAccess

func (i *Index) GetUserAccess(ctx context.Context, userIDHash *[32]byte, kind access.Kind, accessID []byte) ([]byte, access.Level, error)

func (*Index) GetUserByCode

func (i *Index) GetUserByCode(ctx context.Context, code uint64) (*userModel.User, error)

func (*Index) GetUserPasswordHash

func (i *Index) GetUserPasswordHash(ctx context.Context, userAddr common.Address) ([]byte, error)

func (*Index) ListDocByType

func (i *Index) ListDocByType(ctx context.Context, userID, systemID string, docType types.DocumentType) ([]model.DocumentMeta, error)

func (*Index) MultiCallEhrNew

func (i *Index) MultiCallEhrNew() *MultiCallTx

func (*Index) MultiCallUsersNew

func (i *Index) MultiCallUsersNew() *MultiCallTx

func (*Index) SendSingle

func (i *Index) SendSingle(ctx context.Context, data []byte, kind MulticallKind) (string, error)

func (*Index) SetAccess

func (i *Index) SetAccess(ctx context.Context, subjectIDHash *[32]byte, accessObj *AccessObject, userPrivKey *[32]byte) (string, error)

func (*Index) SetAccessWrapper

func (i *Index) SetAccessWrapper(subjectIDHash *[32]byte, accessObj *AccessObject, userPrivKey *[32]byte) ([]byte, error)

func (*Index) SetAllowed

func (i *Index) SetAllowed(ctx context.Context, address string) (string, error)

func (*Index) SetEhrSubject

func (i *Index) SetEhrSubject(ctx context.Context, ehrUUID *uuid.UUID, subjectID, subjectNamespace string, privKey *[32]byte) ([]byte, error)

func (*Index) SetEhrUser

func (i *Index) SetEhrUser(ctx context.Context, userID, systemID string, ehrUUID *uuid.UUID, privKey *[32]byte) ([]byte, error)

func (*Index) TxWait

func (i *Index) TxWait(ctx context.Context, hash string) (uint64, error)

func (*Index) UserGroupAddUser

func (i *Index) UserGroupAddUser(ctx context.Context, addUserID, addSystemID string, level access.Level, groupID *uuid.UUID, addingUserIDEncr, groupKeyEncr []byte, privKey *[32]byte) (string, error)

func (*Index) UserGroupCreate

func (i *Index) UserGroupCreate(ctx context.Context, groupID *uuid.UUID, idEncr, keyEncr, contentEncr []byte, privKey *[32]byte) ([]byte, error)

func (*Index) UserGroupGetByID

func (i *Index) UserGroupGetByID(ctx context.Context, groupID *uuid.UUID) (*userModel.UserGroup, error)

func (*Index) UserGroupRemoveUser

func (i *Index) UserGroupRemoveUser(removeUserID, removeSystemID string, groupID *uuid.UUID, privKey *[32]byte) ([]byte, error)

func (*Index) UserNew

func (i *Index) UserNew(ctx context.Context, userID, systemID string, role uint8, pwdHash, content []byte, userPrivKey *[32]byte) ([]byte, error)

type MultiCallTx

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

func (*MultiCallTx) Add

func (m *MultiCallTx) Add(kind uint8, packed []byte)

func (*MultiCallTx) Commit

func (m *MultiCallTx) Commit() (string, error)

func (*MultiCallTx) GetTxKinds

func (m *MultiCallTx) GetTxKinds() []uint8

type MulticallKind

type MulticallKind uint8
const (
	MulticallEhr MulticallKind = iota
	MulticallUsers
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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