data

package
v0.0.0-...-5de6587 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessData

type AccessData struct {
	Id                 string
	Address            string
	IsApprovedForAll   bool
	IsUpdateManager    bool
	IsOwner            bool
	IsOperator         bool
	IsUpdateOperato    bool
	IsUpdateAuthorized bool
}

func (*AccessData) HasAccess

func (ad *AccessData) HasAccess() bool

type Authorization

type Authorization interface {
	UserCanModifyParcels(pubkey string, parcelsList []string) (bool, error)
	IsSignatureValid(msg, hexSignature, hexAddress string) bool
}

type AuthorizationService

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

func NewAuthorizationService

func NewAuthorizationService(client Decentraland) *AuthorizationService

func (AuthorizationService) IsSignatureValid

func (service AuthorizationService) IsSignatureValid(msg, hexSignature, hexAddress string) bool

func (AuthorizationService) UserCanModifyParcels

func (service AuthorizationService) UserCanModifyParcels(pubkey string, parcelsList []string) (bool, error)

type DclClient

type DclClient struct {
	ApiUrl string
	Agent  *metrics.Agent
}

func NewDclClient

func NewDclClient(apiUrl string, agent *metrics.Agent) *DclClient

func (DclClient) GetParcelAccessData

func (dcl DclClient) GetParcelAccessData(address string, x int64, y int64) (*AccessData, error)

Retrieves the access data of a address over a given accessData

type Decentraland

type Decentraland interface {
	GetParcelAccessData(address string, x int64, y int64) (*AccessData, error)
}

type Estate

type Estate struct {
	ID             string `json:"id"`
	Owner          string `json:"owner"`
	UpdateOperator string `json:"update_operator"`
	Data           struct {
		Parcels []*Parcel `json:"parcels"`
	} `json:"data"`
}

type MapResponse

type MapResponse struct {
	Ok   bool `json:"ok"`
	Data struct {
		Assets struct {
			Parcels []*Parcel `json:"parcels"`
			Estates []*Estate `json:"estates"`
		} `json:"assets"`
	} `json:"data"`
}

type Parcel

type Parcel struct {
	ID             string `json:"id"`
	X              int    `json:"x"`
	Y              int    `json:"y"`
	Owner          string `json:"owner"`
	UpdateOperator string `json:"update_operator"`
	EstateID       string `json:"estate_id"`
}

type Redis

type Redis struct {
	Client *redis.Client
	Agent  *metrics.Agent
}

func NewRedisClient

func NewRedisClient(address string, password string, db int, agent *metrics.Agent) (*Redis, error)

func (Redis) AddCID

func (r Redis) AddCID(cid string) error

func (Redis) ClearScene

func (r Redis) ClearScene(cid string) error

func (Redis) GetParcelCID

func (r Redis) GetParcelCID(pid string) (string, error)

func (Redis) GetParcelContent

func (r Redis) GetParcelContent(parcelID string) (map[string]string, error)

func (Redis) GetParcelMetadata

func (r Redis) GetParcelMetadata(parcelID string) (map[string]interface{}, error)

func (Redis) GetRootCid

func (r Redis) GetRootCid(sceneCID string) (string, error)

func (Redis) GetSceneCid

func (r Redis) GetSceneCid(rootCID string) (string, error)

func (Redis) GetSceneParcels

func (r Redis) GetSceneParcels(cid string) ([]string, error)

func (Redis) IsContentMember

func (r Redis) IsContentMember(value string) (bool, error)

func (Redis) ProcessedParcel

func (r Redis) ProcessedParcel(pid string) (bool, error)

func (Redis) SaveRootCidSceneCid

func (r Redis) SaveRootCidSceneCid(rootCID, sceneCID string) error

func (Redis) SetProcessedParcel

func (r Redis) SetProcessedParcel(pid string) error

func (Redis) SetSceneParcels

func (r Redis) SetSceneParcels(scene string, parcels []string) error

This function maps scene cid to list of parcels "Qvcslk2duadjao0rsdfaZaAAA"... -> ["35,-145", "-22,14"] Every every parcel or pair of coordinates must be unique for between all scenes, so we need to check for every parcel if it got a scene before and delete it if needed Parcels will map its own cid, "99,108" -> Qvcslk2duadjao0rsdfaZaAAA... We can be tempted to remove the old parcel -> old cid map, but that would break the /mappings map, so for now we are going to keep that map and check the validity of the cid when requesting /scenes, thing that will be updatable once removed the /mappings endpoint

func (Redis) StoreContent

func (r Redis) StoreContent(key string, field string, value string) error

func (Redis) StoreMetadata

func (r Redis) StoreMetadata(key string, fields map[string]interface{}) error

type RedisClient

type RedisClient interface {
	GetParcelMetadata(parcelID string) (map[string]interface{}, error)
	GetParcelContent(parcelID string) (map[string]string, error)
	StoreContent(key string, field string, value string) error
	StoreMetadata(key string, fields map[string]interface{}) error
	AddCID(cid string) error
	IsContentMember(value string) (bool, error)

	// Retrieves the root cid of the given parcel
	GetParcelCID(pid string) (string, error)

	// Deletes the mapping root cid -> [parcels]
	ClearScene(cid string) error
	// Updates the mapping root cid -> [parcels]
	SetSceneParcels(cid string, pid []string) error
	// Gets the mapping root cid -> [parcels]
	GetSceneParcels(cid string) ([]string, error)

	// Flags parcels as processed, this is used for flagging when the root cid -> parcels maps has been created
	SetProcessedParcel(pid string) error
	// Retrieves whether a parcels has been processed
	ProcessedParcel(pid string) (bool, error)

	// Saves the map root cid <--> scene cid
	SaveRootCidSceneCid(rootCID, sceneCID string) error
	// Retrieves the scene cid given the root cid of a scene
	GetSceneCid(rootCID string) (string, error)
	// Retrieves the root cid given the scene cid of a scene
	GetRootCid(sceneCID string) (string, error)
}

Jump to

Keyboard shortcuts

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