投稿時間:2023-03-22 07:10:27 RSSフィード2023-03-22 07:00 分まとめ(10件)
カテゴリー等 | サイト名等 | 記事タイトル・トレンドワード等 | リンクURL | 頻出ワード・要約等/検索ボリューム | 登録日 |
---|---|---|---|---|---|
IT | ITmedia 総合記事一覧 | [ITmedia ビジネスオンライン] 新人研修、企業の悩みどころは? 「マナー習得」「やりがいの持たせ方」を上回った1位は | https://www.itmedia.co.jp/business/articles/2303/20/news125.html | itmedia | 2023-03-22 06:30:00 |
IT | ビジネス+IT 最新ニュース | 【業界激震】中国大手航空会社が輸送力世界1位 急成長の理由 日本に勝機は? | https://www.sbbit.jp/article/cont1/109053?ref=rss | 2023-03-22 06:10:00 | |
カグア!Google Analytics 活用塾:事例や使い方 | テレビ番組のリサーチ会社17社とSNSでの打診テンプレとリサーチ本のおすすめ | https://www.kagua.biz/contents-seo/benchmark/research.html | 時代背景 | 2023-03-21 21:00:28 | |
AWS | AWS Networking and Content Delivery | Monitoring AWS Global Network Performance | https://aws.amazon.com/blogs/networking-and-content-delivery/monitoring-aws-global-network-performance/ | Monitoring AWS Global Network PerformanceAs an AWS customer you might often want to understand the performance of the AWS Global Network Visibility into how the AWS Global Network is performing at any given time can help you plan expansions into new AWS Regions and Availability Zones AZs as well as streamline troubleshooting of performance related incidents Today I m happy to … | 2023-03-21 21:54:52 |
海外TECH | Ars Technica | Here’s the full analysis of newly uncovered genetic data on COVID’s origins | https://arstechnica.com/?p=1925722 | originsthe | 2023-03-21 21:28:26 |
海外TECH | MakeUseOf | How to Check Who You've Blocked on Facebook | https://www.makeuseof.com/check-blocked-friends-facebook/ | 2023-03-21 21:05:16 | |
海外TECH | DEV Community | Decentralized Databases: ComposeDB | https://dev.to/fllstck/decentralized-databases-composedb-49m3 | Decentralized Databases ComposeDBWhen I entered the Web space in my first question was What is the database of choice The answers were a bit unsatisfying There were the omnipresent blockchain networks which were expensive and slow and there were decentralized storage networks that focused on object storage at that time Their more granular APIs could have been more convenient to use And finally there were pp databases that stored all data on the client which didn t seem optimal to me either Much has changed in the last few years so I wanted to check out the decentralized database products I wanted to do a series on decentralized databases where I would build a backend for a blog with different database solutionsーstarting with ComposeDB What is Compose DB ComposeDB is a graph database created by BoxLabs a company well known in the Web ecosystem for their work on decentralized identifiers DIDs and their main product the Ceramic network Ceramic is a network of nodes that store and share composable data streams on top of libpp the network stack that also powers IPFS The goal of Ceramic is to enable decentralized storage independent from a specific blockchain network This way you can store your data in a decentralized manner and use it on DApps independently of what blockchain powers them Ceramic is the low level infrastructure and ComposeDB gives you a graph database on top of it So ComposeDB is part of every Ceramic node You define models with GraphQL schemas so you can query the data from a node via GraphQL too When two or more nodes use the same model they start synchronizing their data which leads to decentralization To get data into the network you must host your own node and add your schema If others think your models are worth their resources they can load your schema and start mirroring it There is no incentivization layer in the form of tokens While on a blockchain network you have to pay fees for data you want to store the node operators have to interact manually to figure out what to keep and who they allow to upload it So let s build a decentralized blog with it FeaturesAuthenticationProfile creation and updateArticle creation and updateCommenting on articlesReading profiles articles and comments ArchitectureThe architecture of a ComposeDB powered backend would look something like this The orange Ceramic nodes share a model and synchronize their data the red ones are Ceramic nodes without or with different models PrerequisitesNode js ImplementationLet s start by creating a new Node js project and installing all dependencies with these commands mkdir composedb amp amp cd composedb npm init y npm i ceramicnetwork cli ceramicnetwork http client composedb cli composedb devtools composedb devtools node dids key did provider ed key did resolver uintarrays Creating the Ceramic Config FileAfter this we can create an NPM script in the package json to start a Ceramic node scripts ceramic ceramic daemon config config daemon config json This script starts the Ceramic node and creates a new config file You have to stop it with ctrl c since we will edit the config file later and have to restart it with the updated config file npm run ceramic Creating the Admin AccountTo be able to modify the database via its API we need an admin account Let s create a script for it and make sure you use the mjs extension File scripts setup account mjs import mkdirSync readFileSync writeFileSync from fs import execSync from child process const composeDb args gt execSync composedb args join encoding utf trim mkdirSync account const adminKey composeDb did generate private key writeFileSync account admin key adminKey const adminDid composeDb did from private key adminKey writeFileSync account admin did adminDid const daemonConfig JSON parse readFileSync config daemon config json encoding utf daemonConfig http api admin dids push adminDid writeFileSync config daemon config json JSON stringify daemonConfig This script will generate a random private key and use it to generate a DID Both get saved into the account directory and added to the Ceramic config file we created before To run the account creation execute the following command node scripts setup account mjs Creating the SchemaThe schema consists of multiple GraphQL files they all get indexed by the Ceramic node and then linked to each other ComposeDB comes with DID based accounts out of the box so we don t have to implement them ourselves Creating the Profile ModelHaving more info about a user than just their DID would be nice so let s start with a profile model File schema profile graphql type Profile createModel accountRelation SINGLE description Author profile author DID documentAccount name String string minLength maxLength bio String string maxLength Profile uses the createModel directive which marks the type as a model for ComposeDBaccountRelation describes how many instances of this model a ComposeDB account can have in this case onedescription helps people who find the model in the registryauthor field adds the owning account to the Profilename and bio fields are just text with a length definition Creating the Article ModelWhat is a blog without articles I know I know most of us never get to the actual writing because we are preoccupied with building blogs just like right now lol File schema article graphql type Profile loadModel id PROFILE ID id ID type Article createModel accountRelation LIST description Text written by an author author DID documentAccount title String string maxLength date DateTime content String string maxLength profileId StreamID documentReference model Profile loadModel will load a model with a specific ID from the Ceramic node We don t have that ID because we didn t index Profile yet so we put in a placeholder that will be replaced by a script lateraccountRelation is a LIST because an account can have more than one article even if it has a low probability of happening author Again the ID of the account that created the recordtitle and content for the actual content of the articledate to log when the article was createdprofileId to embed the Profile from before that way we can load it as part of the Article in one query Creating the Comment ModelNow what are articles without flame wars right So let s add a Comment model to spice things up a bit File schema comment graphql type Article loadModel id ARTICLE ID id ID type Comment createModel accountRelation LIST description A comment on an article author DID documentAccount content String string maxLength articleId StreamID documentReference model Article loadModel to get the indexed Article model so that we can link it to each commentaccountRelation is a LIST because an account can have more than one commentauthor Again the ID of the account that created the recordcontent for the actual content of the commentarticleId to embed the Article from before that way we can load it as part of the Comment in one query Link Article and Comment ModelsNow we can show a Profile on an article and an Article on a comment but it would be much more interesting to show multiple Comment instances on an Article For this we have to create another schema File schema article comment graphql type Comment loadModel id COMMENT ID id ID type Article loadModel id ARTICLE ID comments Comment relationFrom model Comment property articleId We load the indexed Comment model from our Ceramic node and the indexed Article model but this time we extend the Article model with a relation The relationFrom directive will create a field that checks the articleId of our Comment models match the ID of a corresponding Article when requested Indexing the SchemaWe need to get all these models loaded by our Ceramic node so we create a script that replaces our ID placeholders before it loads a model This way we can link our models with the correct model IDs without manually adding them to the schema definitions Again make sure you use the mjs extension File scripts setup schema mjs import execSync from child process import readFileSync from fs import CeramicClient from ceramicnetwork http client import DID from dids import EdProvider from key did provider ed import getResolver from key did resolver import fromString from uintarrays from string import Composite from composedb devtools import createComposite writeEncodedComposite from composedb devtools node const privateKey fromString readFileSync account admin key encoding utf trim base const did new DID resolver getResolver provider new EdProvider privateKey await did authenticate const ceramic new CeramicClient ceramic did didconst profileComposite await createComposite ceramic schema profile graphql const articleSchema readFileSync schema article graphql encoding utf replace PROFILE ID profileComposite modelIDs const articleComposite await Composite create ceramic schema articleSchema const commentSchema readFileSync schema comment graphql encoding utf replace ARTICLE ID articleComposite modelIDs const commentComposite await Composite create ceramic schema commentSchema const articleCommentSchema readFileSync schema article comment graphql encoding utf replace ARTICLE ID articleComposite modelIDs replace COMMENT ID commentComposite modelIDs const articleCommentComposite await Composite create ceramic schema articleCommentSchema const composite Composite from profileComposite articleComposite commentComposite articleCommentComposite await writeEncodedComposite composite composites blog json await composite startIndexingOn ceramic execSync composedb composite compile composites blog json composites blog runtime json ceramic url execSync composedb composite compile composites blog json composites blog runtime js ceramic url First we load the private key to authenticate with the Ceramic node Then we load each model replace the ID placeholders with stream IDs and create a composite After creating and linking all models we merge them so our node can index them We then save the merged composite to disk at composites blog json and compile two runtime composites from it that go into the same directory Our GraphQL server will use these runtime composites later To run the script we have to start the Ceramic node again and execute the script each in different command lines Start the node with this command npm run ceramicOpen another command line and run the script with the following command node scripts setup schema mjsAfter this our models should be queryable Testing the SchemaWe can test the schema using the GraphQL server that ships with the ComposeDB CLI Let s add an NPM script for this File package json scripts graphql composedb graphql server graphiql composites blog runtime json ceramic url did private key cat account admin key port The GraphQL server will use the runtime composite we generated and connect to the Ceramic node If you open http localhost graphql you ll see the Yoga GraphiQL interface and can start issuing queries Querying your AccountThe most straightforward query is for the currently active account the viewer Query viewer id isViewer Response data viewer id did key isViewer true In the case of the GraphQL server the viewer is the admin account we created Obviously isViewer is true when we query our current account Creating a ProfileIf we use the auto completion of GraphiQL we see the models we indexed are already available But we didn t create records for our models Records are called nodes and edges in a graph database but I will use records to prevent confusion with the Ceramic nodes So let s start by creating a Profile for our admin To do so run this mutation Mutation mutation createProfile input content name Admin bio The creator of this blog profile document name bio Response data createProfile profile name Admin bio The creator of this blog Loading the ProfileNow we can use the viewer to receive the profile we created Query viewer profile name bio Response data viewer profile name Admin bio The creator of this blog If we want to load the profile for another user we can use ComposeDB s built in Node type Every document is a Node we must use inline fragments to define which kind of nodes we want Query profile node id on Profile name bio Response data profile name Admin bio The creator of this blog Creating and Updating an ArticleNow that we have a profile we can start writing something Mutation mutation createArticle input content date T Z title First Article content This is some content profileId article document date title content Response data createArticle article date T Z title First Article content This is some content If we wanted to update the article s title the mutation would look like this Mutation mutation updateArticle input id content title New title article document title Response data updateArticle article title New title Loading Profile with Articles and Article with ProfileNow in a blog UI we want to show the profile of a user and all of their articles Depending on what ID we have at hand we can either query the profile by ID and traverse to the article list of the owner of the profile Query profile node id on Profile name bio author articleList last articles edges article node id date title Response data profile name Admin bio The creator of this blog author articleList articles article id date T Z title New title We can also start from the account and get the profile and article record Query account node id did key on CeramicAccount profile name bio articleList last articles edges article node id date title Response data account profile name Admin bio The creator of this blog articleList articles article id date T Z title New title Creating and Loading CommentsLet s start with adding comments to an article Mutation mutation createComment input content content Hello articleId comment document content Response data createComment comment content Hello Now that we have an article with a comment we can query the article with the author s name and all related comments with their author s name Query article node id on Article author profile name date title content comments last edges node author profile name content Response data article author profile name Admin date T Z title New title content This is some content comments edges node author profile name Admin content Hello No Data DeletionThere is no way to delete data on IPFS for sure so we ll be missing out on that feature of our blog If the network participants deem it necessary enough they will pin it all over the place and keep it from getting deleted We can write update methods that remove content and mark it as deleted for the UX But remember that users might be surprised when they find their content elsewhere SummaryEven though ComposeDB is still in beta it looks like a promising database solution for your DApp It distributes data via the Ceramic Network which in turn is built on top of IPFS It doesn t have any token based incentivization layer yet but that is a plus for some people If someone cares about a DApp they can host a Ceramic node and import the relevant models to mirror the data ComposeDB is a graph database that can be confusing when you come from a relational database but its GraphQL interface might still be familiar to the average developer Additional ResourcesGitHub Repository | 2023-03-21 21:18:56 |
海外科学 | NYT > Science | A ‘Rocking Chair Rebellion’: Seniors Call On Banks to Dump Big Oil | https://www.nytimes.com/2023/03/21/climate/climate-change-protests-oil-banks.html | fossil | 2023-03-21 21:51:08 |
ニュース | BBC News - Home | Counter terror police help investigation as man set alight near Birmingham mosque | https://www.bbc.co.uk/news/uk-england-birmingham-65030005?at_medium=RSS&at_campaign=KARANGA | london | 2023-03-21 21:48:54 |
ニュース | BBC News - Home | Martina Navratilova: Tennis legend says she is 'cancer-free' after treatment | https://www.bbc.co.uk/sport/tennis/65021842?at_medium=RSS&at_campaign=KARANGA | Martina Navratilova Tennis legend says she is x cancer free x after treatmentMartina Navratilova an time Grand Slam singles champion says she is cancer free after fearing she would not see next Christmas | 2023-03-21 21:43:59 |
コメント
コメントを投稿