Register_peers support for receptor_addresses

register_peers has inputs:

source: source instance
peers: list of instances the source should peer to

InstanceLink "target" is now expected to be a ReceptorAddress

For each peer, we can just use the first receptor address. If
multiple receptor addresses exist, throw a command error.

Currently this command is only used on VM-deployments, where
there is only a single receptor address per instance, so this
should work fine.

Other changes:
drop listener_port field from Instance. Listener port is now just
"port" on ReceptorAddress

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
Seth Foster
2023-11-02 14:08:13 -04:00
committed by Seth Foster
parent bca68bcdf1
commit 3a17c45b64
7 changed files with 48 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
# Generated by Django 4.2.5 on 2023-10-10 00:26
# Generated by Django 4.2.6 on 2023-11-02 18:07
from django.db import migrations, models
import django.db.models.deletion
@@ -15,8 +15,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('address', models.CharField(max_length=255)),
('port', models.IntegerField()),
('protocol', models.CharField(max_length=10)),
('port', models.IntegerField(default=27199)),
('protocol', models.CharField(default='tcp', max_length=10)),
('websocket_path', models.CharField(blank=True, default='', max_length=255)),
('is_internal', models.BooleanField(default=False)),
('peers_from_control_nodes', models.BooleanField(default=False)),
@@ -30,6 +30,10 @@ class Migration(migrations.Migration):
name='instancelink',
unique_together=set(),
),
migrations.RemoveField(
model_name='instance',
name='listener_port',
),
migrations.AlterField(
model_name='instancelink',
name='source',
@@ -40,6 +44,11 @@ class Migration(migrations.Migration):
name='instance',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='receptor_addresses', to='main.instance'),
),
migrations.AddField(
model_name='activitystream',
name='receptor_address',
field=models.ManyToManyField(blank=True, to='main.receptoraddress'),
),
migrations.AlterField(
model_name='instance',
name='peers',